1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Juli2301 [7.4K]
3 years ago
8

I am coding a turtle race in python I have to Use a single call to forward for each turtle, using a random number as the distanc

e to move
Computers and Technology
2 answers:
german3 years ago
5 0

import turtle,random

s = turtle.getscreen()

t1 = turtle.Turtle()

t2 = turtle.Turtle()

t3 = turtle.Turtle()

t2.penup()

t2.goto(1,100)

t3.penup()

t3.goto(1,200)

while True:

   t1.forward(random.randint(1,10))

   t2.forward(random.randint(1,10))

   t3.forward(random.randint(1,10))

   if t1.xcor() >= 180:

       print("Turtle 1 won the race!")

       quit()

   elif t2.xcor()>= 180:

       print("Turtle 2 won the race!")

       quit()

   elif t3.xcor() >= 180:

       print("Turtle 3 won the race")

       quit()

I hope this helps!

lesantik [10]3 years ago
3 0

Answer:

if you mean to set a speed. Im not sure. however, move turtle.forward(random number) i can do

import turtle

import random

random_int = random.randint(20, 1000)

win = turtle.Screen()

turtle_1 = turtle.Turtle()

turtle_1.forward(random_int)

win.mainloop()

You might be interested in
Which invention provided instant communication and information to a massive audience for the first time?
igor_vitrenko [27]
B. Television. It provided <span>instant communication and information to a massive audience for the first time in 1927.

Hope this helps :)</span>
4 0
3 years ago
Read 2 more answers
Hope goes through the steps of sorting a list. The resulting list is shown below.
Dmitry [639]

Answer:

Click the Header Row option.

Explanation:

7 0
3 years ago
Once a table is inserted into a publication, which two tabs become available?
rusak2 [61]

Answer:

insert i think sry if its wrong :(

Explanation:

7 0
3 years ago
Which of these is an example of rebranding ?
suter [353]
What are the options
7 0
4 years ago
Read 2 more answers
Software piracy is acceptable as it helps us obtain software cheaper or sometimes even for free.
mr Goodwill [35]

Answer:

1: false because it's just scams

2: true

Explanation:

3 0
3 years ago
Other questions:
  • Dani wants to create a web page to document her travel adventures. Which coding language should she use? HTML Java Python Text
    15·1 answer
  • Given a floating point variable fraction, write a statement that displays the value of fraction on the screen. Do not display an
    13·1 answer
  • Which type of operation writes the file system structure to the disk?
    5·1 answer
  • Is using abbreviations and symbols in social media a problem? Why or why not?
    11·1 answer
  • Enter the value of 5⋅(13.5−4.5). <br> ​
    5·1 answer
  • An employee who interacts with customers regarding the nature of their car problems, rather than actually working on the vehicle
    6·1 answer
  • What is the clearing house for domain names called?
    12·1 answer
  • PAGE<br>DATE<br>0 What types of information should be there internet?​
    5·1 answer
  • True or false. The CPU requires it's own power from the power supply, and can't receive power from the motherboard.
    9·1 answer
  • What was the first edition of the internet?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!