Python-Turtle: Turning list of Strings into a working code
#There are large test lists of strings which need to be turned
# into workable code. But i keep getting 'cant assign to literal' error
from turtle import *
#Define the scripting language
'lift pen' = pu()
'lower pen' = pd()
'thin lines' = pensize(1)
'thick lines' = pensize(5)
'black pen' = color('black')
'coloured pen' = color('green')
'go to',x,y = goto(x,y)
'draw dot', s = dot(s)
def draw(test):
home()
total = len(test)
list_num = 0
while total > 0:
print test[list_num]
list_num = list_num + 1
total = total - 1
hideturtle()
draw(puzzle)
No comments:
Post a Comment