I am completely new to python and when i was playing with a while loop in the Python SHELL the code works but when I then put it into a file and saved and then tried to run it I got the error "NameError: name 'b' is not defined".
I have looked on this site but I cannot find a simple answer my code is as follows:-
while b <= 10: print (b) b += 1
If I declare b as zero at the top of the program above the while command the program runs but into an infinate loop WHY? I expected the loop to jump back to the while command line not to include the original declaration.
Thanks for you help.
I am using version 3.3 if this makes any difference. Thanks again.
Edited 4 Years Ago by deepthought