from math import from tkinter import map int input split root Tk I1 J1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from math import *
from tkinter import *
x, y, n, l, k = map(int, input().split())
root = Tk()
I1 = 0
J1 = 0
I2 = 500
J2 = 500
canv = Canvas(root, width = I2, height = J2, bg = 'lightblue')
def koh(x, y, n, l, k):
if k >= 1:
alpha = pi / n
for i in range(n):
x1 = x + (l / 2) * cos(alpha * (i))
y1 = y - (l / 2) * sin(alpha * (i))
x2 = x - (l / 2) * cos(alpha * (i))
y2 = y + (l / 2) * sin(alpha * (i))
canv.create_line(x1, y1, x2, y2, width = 0.5)
koh(x1, y1, n, l/3, k - 1)
koh(x2, y2, n, l/3, k - 1)
koh(x, y, n, l, k)
canv.pack()
root.mainloop()
300 300 5 200 4