I am trying to do is use a for
loop to move a turtle but the error message expected type collections.iterable got int instead I have no idea why this is happening
fred = turtle
fred.shape("turtle")
for x in 20:
fred.width(5)
fred.forward(10)
the error refers to the line
for x in 20:
20
is of type int
and cannot be iterated over you should use range()
for x in range(20):
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.