mardi 2 février 2021

Turtle Implementation(Python)

How can i randomly move turtle and stop if it arrives at a certain point as of now this i thought of

turtle.forward(10) # Moves forward
sleep(0.1)
b = uniform(-75,0) # Moves Backward
turtle.back(b)
turtle.forward(10)
sleep(0.1)
c = uniform(0,75) # Moves Left
turtle.left(c)    
turtle.forward(10)
sleep(0.1)
d = uniform(0,-75) # Moves right
turtle.right(d)
turtle.forward(10)
sleep(0.1)

i tried using for loop but it is not effective i've tried to know adding if statement for adding random.choice however im not familiar of using it please help :(




Aucun commentaire:

Enregistrer un commentaire