Skip to content

Commit 3436d1e

Browse files
committed
changes done
1 parent 2563b8f commit 3436d1e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

TurtleRace/TurtleRace.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import turtle as t
22
import random
3+
import time
34

45
scr = t.Screen()
56
scr.setup(width=500, height=500)
@@ -27,9 +28,16 @@
2728
if runner.xcor() > 230:
2829
winner = runner.pencolor()
2930
RaceRunning = False
31+
show = t.Turtle()
32+
show.hideturtle()
33+
show.penup()
34+
show.goto(-200, -150)
35+
show.color("red")
3036
if winner == UserInput:
31-
print("Your turtle won!")
37+
show.write("Your turtle won!")
3238
else:
33-
print(f"Your turtle lost, the winner is {winner} turtle!")
39+
show.write(f"Your turtle lost, the winner is {winner} turtle!")
40+
time.sleep(1)
41+
show.clear()
3442
runner.forward(random.randint(0, 10))
3543
scr.exitonclick()

0 commit comments

Comments
 (0)