Executing Arc Program in Python -
i have wrote arc program use turtleworld execute. result right. in serious issue, can reduce code & can explain me code have wrote. didn't concept. program in exercise session of book
from swampy.turtleworld import * world = turtleworld() bob = turtle() def arc(t=bob, r=50, angle=360): arc_length = 2 * 3.14 * r * angle / 360 n = int(arc_length / 3) + 1 step_length = arc_length / n step_angle = float(angle) / n in range(n): fd(t, step_length) lt(t, step_angle) arc() wait_for_user()
Comments
Post a Comment