Sep-02-2017, 12:13 PM
Hi, I am new to python and I am trying out some things in python and wanted to experiment a bit with while as loop but I keep getting this error
"Traceback (most recent call last):
File "testing.py", line 4, in <module>
choose = input("go on (y) or stop (s)")
File "<string>", line 1, in <module>
NameError: name 'y' is not defined
"
I am able to run the code but when I enter my selection it gives me the error. Is it because if I set a string once it is "forever" and I can't change it again? If it is like that how can I fix it?
Thanks
"Traceback (most recent call last):
File "testing.py", line 4, in <module>
choose = input("go on (y) or stop (s)")
File "<string>", line 1, in <module>
NameError: name 'y' is not defined
"
I am able to run the code but when I enter my selection it gives me the error. Is it because if I set a string once it is "forever" and I can't change it again? If it is like that how can I fix it?
Thanks
loop = 1 while loop == 1: choose = input("go on (y) or stop (s)") if choose == "y": print("ok") loop = 1 if choose == "s": print("See you next time") loop = 0