[Tutor] Turtle drawing
Alan Gauld
alan.gauld at yahoo.co.uk
Tue Jun 5 18:12:57 EDT 2018
On 05/06/18 21:46, Roger Lea Scherer wrote:
> datums = open("C:/Users/Roger/Documents/GitHub/LaunchCode/mystery.txt", "r")
>
> for aline in datums:
> splitted = aline.split()
> try:...
> except:
> while splitted == "UP":
> hadir.pu()
splitted will never equal 'UP' or 'DOWN' because the result
of split() is always a list - even if its empty. So I suspect
you are not actually executing any up/down operations.
Try using splitted[0] instead.
The other problem is that you use a while loop but never
change the condition values so, if it ever did pass the test,
you'd wind up with an infinite loop! You only need an if clause
not a while.
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list