Replies to Msg. #1132468
.
 Msg. #  Subject Posted by    Board    Date   
00479 Re: Python Programming : Turtle Races
   Decomposed > Grrr. The indenting didn't survive. Is OK Boss. I...
Zimbler0   6TH POPE   23 May 2020
12:57 AM
00406 Re: Python Programming : Turtle Races
   
Decomposed  
6TH POPE   22 May 2020
4:46 AM

The above list shows replies to the following message:

Re: Python Programming : Turtle Races

By: Decomposed in 6TH POPE
Fri, 22 May 20 4:42 AM
Msg. 00405 of 60014
(This msg. is a reply to 00404 by Zimbler0)
Jump to msg. #  

Zimbler0:

Re: "Care to share?"
Happy to!

And, no, I haven't done anything with tkinter. This is turtle graphics.


import turtle
import random

number_of_turtles = 8

turtles = [] # Create an empty list.

for i in range(number_of_turtles): # create a turtle, add it to the list
t = turtle.Turtle()
turtles.append(t) # Add it to the list
t.shape('turtle')
t.penup()
t.right(90) # Move each turtle to its own starting place based on the value of i
t.forward(20*i)
t.left(90)

for i in range(100):
for t in turtles: # for each turtle in the list, advance it a random distance. In this case, t is each
t.forward(random.randint(0,6))

turtle.done() # end of program!!! 8 turtles will race with random results.
Grrr. The indenting didn't survive. I'll post the program again as an image.




Avatar

Gold is $1,581/oz today. When it hits $2,000, it will be up 26.5%. Let's see how long that takes. - De 3/11/2013 - ANSWER: 7 Years, 5 Months