-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_Lesson_11.py
More file actions
75 lines (58 loc) · 1.42 KB
/
Copy pathPython_Lesson_11.py
File metadata and controls
75 lines (58 loc) · 1.42 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# break and continue
# soz = input("So'z kiriting: ")
# for s in soz:
# if s.isdigit():
# #break
# continue
# print(s)
# 11 - dastur
from turtle import Turtle, Screen
oyna = Screen()
oyna.title("Bu mening birinchi oynam")
chiziq = Turtle()
chiziq.hideturtle()
chiziq.pensize(3)
chiziq.color('blue')
chiziq.speed(3)
chiziq.up()
chiziq.goto(150,150)
chiziq.down()
chiziq.goto(150,-150)
chiziq.goto(-150, -150)
chiziq.goto(-150,150)
chiziq.goto(150, 150 )
chegara = Turtle()
chegara.color('green')
chegara.pensize(5)
chegara.up()
chegara.goto(-125, -150)
chegara.down()
chegara.goto(-125, -125)
chegara.goto(-40, -125)
chegara.goto(-40, -150)
chegara.hideturtle()
koptok = Turtle()
koptok.shape('circle')
koptok.shapesize(1)
koptok.color('red')
koptok.up()
koptok.goto(0,0)
golyozuvi = Turtle()
golyozuvi.hideturtle()
step_x = 3
step_y = 2
while True:
x, y = koptok.position()
if x + step_x >= 150 or x + step_x <= -150:
step_x = -step_x
if y + step_y >= 150 or y + step_y <= -150:
step_y = -step_y
if x>=-125 and x<=-75 and y>=-150 and y<=-125:
golyozuvi.color('deep pink')
style = ('Courier', 30, 'italic')
golyozuvi.write('Goal!', font=style, align='center')
golyozuvi.hideturtle()
break
koptok.goto(x + step_x, y + step_y)
oyna.mainloop()
# Programming