Text Size
Text Size
Exit Full Screen
Python Mini
Show
Source Code
View Source Code in Full Screen
Open in New Tab
import random from turtle import * c = Screen () c.bgcolor ("black") t = Turtle() a = random.randint(40,50) b = random.randint(40,300) c = random.randint(40,50) d = random.randint(40,300) e = random.randint(40,50) f = random.randint(40,300) g = random.randint(40,50) h = random.randint(40,300) t.speed(0) def check (): endX = int (t.xcor()) endY = int (t.ycor()) if startX == endX and startY == endY: return True # if endX <= 0 or >= 500: # return True endX = 0 endY = 0 t.width (1) t.speed (10) t.pu () t.left (90) t.pd () startX = t.xcor() startY = t.ycor() t.color ('White') t.begin_fill () #while startX != endX and startY != endY: for m in range (1000): t.forward (a) if check (): break t.right (b) t.forward (c) if check (): break t.left (d) t.forward (e) if check (): break t.right (f) t.forward (g) if check (): break t.left (h) t.end_fill () t.pu () t.speed (0) t.forward (100000) t.shape('turtle')
mandalaGen.py
( around 51 lines python code )
Published By:
popbot1
Published on
2018-07-11T12:03:16Z
Python Mini
- an
OYOclass
application,
own your own class today
.
Run
Result
×
Error message shows here