Fun Python Program I Accidentally Wrote

Once this starts go full screen. Let it run for at least 20 minutes. You don’t have to watch it the whole time.

from turtle import *
from random import randint
speed(0)
def wander():
	while True:
		lt(randint(5, 350))
		fd(randint(5, 60))
		if xcor()>=230:		# coordinate of x
			lt(170)
			fd(50)
		if xcor()<=-230:
			lt(170)
			fd(50)
		if ycor()>=200:
			lt(170)
			fd(50)
		if ycor()<=-200:
			lt(170)
			fd(50)
wander()
1 Like

Hey Jerry, if you will put tags like these around your code, we can see the indentation which Python demands…

[code]
[/code]
3 Likes

Thanks. Done.

1 Like