I have to do a coding task in school. I should list several numbers at random and complete the form of a turtle moving around on them. I would like to know how to list the numbers entered in the turtle window. Is it possible?
Asked
Active
Viewed 988 times
2 Answers
0
If you want to enter text then you need turtle.write()
:
import random
a = [random.randint(0,10) for x in range(10)] # Generate 10 random numbers between 0 and 10
for i in a:
turtle.forward(15)
turtle.write(str(i))
You need to move the turtle otherwise all the numbers will appear on top of each other.
See Python Turtle, draw text with on screen with larger font and the documentation for information on turtle.write()

Xantium
- 11,201
- 10
- 62
- 89
0
You can use write
import turtle
if __name__ == '__main__':
number = 42
t = turtle.Turtle()
t.write(number)
turtle.done()

Reblochon Masque
- 35,405
- 10
- 55
- 80