Python code for Turtle Race Write the name of the winner turtle on the screen and on the console. Add one or more of your own improvements. Why my code still given me errors

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Python code for Turtle Race Write the name of the winner turtle on the screen and on the console. Add one or more of your own improvements. Why my code still given me errors
myscreen.bgcolor ('light blue')
myscreen.setup (1.0,1.0)
myscreen.title ('Turtle Race Game')
pen = turtle.Turtle ()
pen.speed (0)
pen.penup()
pen.goto (-200,200)
pen.pendown ()
for i in range (1,11) :
pen.write (i,font = ('Arial',10))
pen.setheading (-90)
pen.forward (250)
for i-10:
pen.write ("FINISH",font=('Arial',14))
pen.back (250)
pen.penup (0
pen.setheading (0)
pen.forward (50)
pen.down ()
finishlineX = 250
def createTurtlePlayer (color, startx, starty):
player = turtle. Turtle ()
player.color (color)
player.shape ("turtel")
player.penup ()
player.goto (startx, starty)
player.pendown ()
return player
pl = creatTurtlePlayer ('red', -210,150)
p2 = creatTurtlePlayer ('blue', -210,100)
p3 = creatTurtlePlayer ('orange', -210,50)
p4 = creatTurtlePlayer ('green', -210,0)
while True:
pl.forward (random.randint (5,10))
if pl.pos () [0]>= finishLineX:
pl.write (' I won the race!!', font=('Arial',30))
break
p2.forward (random.randint (5,10))
if p2.pos ) [0]>= finishLineX:
p2.write (' I won the race!!', font=('Arial',30))
break
p3.forward (random.randint (5,10))
if p3.pos 0 [0]>= finishLineX:
p3.write (' I won the race!!', font=('Arial',30))
break
p4.forward (random.randint (5,10))
if p4.pos () [0]>= finishLineX:
p4.write (' I won the race!!', font=('Arial',30))
break
turtle.done ()
Transcribed Image Text:myscreen.bgcolor ('light blue') myscreen.setup (1.0,1.0) myscreen.title ('Turtle Race Game') pen = turtle.Turtle () pen.speed (0) pen.penup() pen.goto (-200,200) pen.pendown () for i in range (1,11) : pen.write (i,font = ('Arial',10)) pen.setheading (-90) pen.forward (250) for i-10: pen.write ("FINISH",font=('Arial',14)) pen.back (250) pen.penup (0 pen.setheading (0) pen.forward (50) pen.down () finishlineX = 250 def createTurtlePlayer (color, startx, starty): player = turtle. Turtle () player.color (color) player.shape ("turtel") player.penup () player.goto (startx, starty) player.pendown () return player pl = creatTurtlePlayer ('red', -210,150) p2 = creatTurtlePlayer ('blue', -210,100) p3 = creatTurtlePlayer ('orange', -210,50) p4 = creatTurtlePlayer ('green', -210,0) while True: pl.forward (random.randint (5,10)) if pl.pos () [0]>= finishLineX: pl.write (' I won the race!!', font=('Arial',30)) break p2.forward (random.randint (5,10)) if p2.pos ) [0]>= finishLineX: p2.write (' I won the race!!', font=('Arial',30)) break p3.forward (random.randint (5,10)) if p3.pos 0 [0]>= finishLineX: p3.write (' I won the race!!', font=('Arial',30)) break p4.forward (random.randint (5,10)) if p4.pos () [0]>= finishLineX: p4.write (' I won the race!!', font=('Arial',30)) break turtle.done ()
mport random, turtle
myscreen - curtle.Screen ()
myscreen.bgcolor ('light blue')
myscreen.setup (1.0,1.0)
myscreen.title ('Turtle Race Game')
pen = turtle.Turtle ()
pen.speed (0)
pen.penup )
pen.goto (-200,200)
pen.pendown ()
for i in range (1,11):
pen.write (i,font = ('Arial',10))
pen.setheading (-90)
pen.forward (250)
for i 10:
pen.write ("FINISH",font=('Arial',14))
pen.back (250)
pen.penup()
pen.setheading (0)
pen.forward (50)
pen.down (
finishlineX = 250
def createTurtlePlayer (color, startx, starty):
player = turtle. Turtle ()
player.color (color)
player.shape ("turtel")
player.penup ()
player.goto (startx, starty)
player.pendown ()
return player
pl = creatTurtlePlayer ('red', -210,150)
p2 = creatTurtlePlayer ('blue', -210,100)
p3 = creatTurtlePlayer ('orange', -210,50)
creatTurtlePlayer ('green', -210,0)
p4 =
while True:
pl.forward (random.randint (5,10))
if pl.pos ) [0]>= finishLineX:
pl.write (' I won the race!!', font=('Arial',30))
break
p2. forward (random.randint (5,10))
if p2.pos () [0]>= finíshLineX:
p2.write (' I won the race!!', font=('Arial',30))
break
p3.forward (random.randint (5,1i0))
if p3.pos ) [0]>= finishLineX:
p3.write (' I won the race!!', font=('Arial',30))
break
P4.forward(rando
Transcribed Image Text:mport random, turtle myscreen - curtle.Screen () myscreen.bgcolor ('light blue') myscreen.setup (1.0,1.0) myscreen.title ('Turtle Race Game') pen = turtle.Turtle () pen.speed (0) pen.penup ) pen.goto (-200,200) pen.pendown () for i in range (1,11): pen.write (i,font = ('Arial',10)) pen.setheading (-90) pen.forward (250) for i 10: pen.write ("FINISH",font=('Arial',14)) pen.back (250) pen.penup() pen.setheading (0) pen.forward (50) pen.down ( finishlineX = 250 def createTurtlePlayer (color, startx, starty): player = turtle. Turtle () player.color (color) player.shape ("turtel") player.penup () player.goto (startx, starty) player.pendown () return player pl = creatTurtlePlayer ('red', -210,150) p2 = creatTurtlePlayer ('blue', -210,100) p3 = creatTurtlePlayer ('orange', -210,50) creatTurtlePlayer ('green', -210,0) p4 = while True: pl.forward (random.randint (5,10)) if pl.pos ) [0]>= finishLineX: pl.write (' I won the race!!', font=('Arial',30)) break p2. forward (random.randint (5,10)) if p2.pos () [0]>= finíshLineX: p2.write (' I won the race!!', font=('Arial',30)) break p3.forward (random.randint (5,1i0)) if p3.pos ) [0]>= finishLineX: p3.write (' I won the race!!', font=('Arial',30)) break P4.forward(rando
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 6 images

Blurred answer
Knowledge Booster
Passing Array as Argument
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education