Контрольная работа по "Программированию"
Автор: 12345678o • Декабрь 7, 2020 • Контрольная работа • 1,810 Слов (8 Страниц) • 220 Просмотры
from Tkinter import *
import math
master = Tk()
w = Canvas(master, width=3000, height=3000)
x = 0
y = 0
i = 0
n = input(int())
s = []
for i in range(n):
x = 200 + 100 * math.cos(math.pi/n * (1 + 2 * i))
y = 200 + 100 * math.sin(math.pi/n * (1 + 2 * i))
s.append(x)
s.append(y)
u = 0
o = 1
b1 = s[2*n-2]
b2 = s[2*n-1]
for i in range(n):
w.pack()
w.create_line(b1, b2, s[u], s[o])
b1 = s[u]
b2 = s[o]
u += 2
o += 2
mainloop()
from Tkinter import *
import math
master = Tk()
w = Canvas(master, width=3000, height=3000)
x = 0
y = 0
i = 0
l = 100
n = input(int())
s = []
a = 30*math.pi/180
sin = math.sin(a)
cos = math.cos(a)
for i in range(n):
x = l * sin
y = l * cos
a = a + a
sin = sin + math.sin(a)
cos = cos + math.cos(a)
s.append(x)
s.append(y)
u = 0
o = 1
b1 = s[2*n-2]
b2 = s[2*n-1]
for i in range(n):
w.pack()
w.create_line(b1, b2, s[u], s[o])
b1 = s[u]
b2 = s[o]
u += 2
o += 2
mainloop()
from Tkinter import *
import math
master = Tk()
w = Canvas(master, width=3000, height=3000)
x0 = 0
y0 = 0
x = 0
y = 0
i = 0
l = 50
n = input(int())
k = 300
v = 300
e = 180 - ((n-2)*180/n)
s = []
a1 = e*math.pi/180
a = e*math.pi/180
sin = math.sin(a)
cos = math.cos(a)
for i in range(n):
x = l * cos
y = l * sin
a = a + a1
sin = sin + math.sin(a)
cos = cos + math.cos(a)
w.pack()
g = w.create_line(x0 + k, y0 + v, x + k, y + v)
print(x, y)
x0 = x
y0 = y
mainloop()
from Tkinter import *
import math
master = Tk()
w = Canvas(master, width=3000, height=3000)
f = []
x0 = 0
y0 = 0
x = 0
y = 0
i = 0
t = 0
l = 50
n = int(input())
T = int(input())
k = 300
v = 300
e = 180 - ((n-2)*180/n)
a1 = e*math.pi/180
a = e*math.pi/180
sin = math.sin(a)
cos = math.cos(a)
for t in range(T):
for i in range(n):
if t < 1:
x = l * cos
y = l * sin
f.append(a * 180 / math.pi)
a = a + a1
sin = sin + math.sin(a)
cos = cos + math.cos(a)
w.pack()
g = w.create_line(x0 + k, y0 + v, x + k, y + v)
x0 = x
y0 = y
else:
x = l * cos
y = l * sin
f.append(a * 180 / math.pi)
a = a + a1
sin = sin + math.sin(a)
cos = cos + math.cos(a)
x0 = l*t
w.pack()
g = w.create_line(x0 + k, y0 + v, x + k, y + v)
x0 = x + x0
y0 = y
a = a1
sin = math.sin(a)
cos = math.cos(a)
print(f)
f = []
w.create_rectangle(k, v, k+3, v+3)
mainloop()
...