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
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
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 ()](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff0cf266d-2716-43df-a933-4e675dde218b%2F216560ad-19ca-4a36-a7f2-0466aeca26d4%2F6yn5n0m_processed.jpeg&w=3840&q=75)
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff0cf266d-2716-43df-a933-4e675dde218b%2F216560ad-19ca-4a36-a7f2-0466aeca26d4%2Fbkuwut7_processed.jpeg&w=3840&q=75)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 6 images

Knowledge Booster
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.Recommended textbooks for you

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education