python - TypeError: 'int' object is not iterable shape drawing -
hey trying learn python , trying write program draw different shapes. working except part define drawshapes @ end error:
traceback (most recent call last): file "/users/seanrose/desktop/homework 4-1.py", line 126, in <module> drawshapes(nick, allshapes[i]) file "/users/seanrose/desktop/homework 4-1.py", line 121, in drawshapes in (numberofside): typeerror: 'int' object not iterable
can help?
http://imgur.com/9zvmtx4,5ztqcrx sorry here image code
or here part isnt working wn = turtle.screen() nick = turtle.turtle() nick.color(penco) nick.pensize(penwid) wn.bgcolor(bcco)
def drawshapes(t, typeofshape): totaldegrees = typeofshape[0] numberofside = typeofshape[1] lengthofsides = typeofshape[2] whatkindofshape = typeofshape[3] t.write(whatkindofshape) in (numberofside): t.forward(lengthofsides) t.left(totaldegrees/numberofside) in range(len(allshapes)): drawshapes(nick, allshapes[i])
from error message, seem have code:
for in (numberofside):
since numberofside
integer, not work. if want iterate on numbers 0 numberofside
, try this.
for in range(numberofside):
Comments
Post a Comment