Dec-06-2018, 05:07 PM
Hi, I'm new to python. I've coded this to check whether an inputted name is between 3 and 10 letters and to ask the user whether they want to change it or not if it is. However, when I try to run it I get the error: 
File "/Users/archie/Downloads/namecheck/namecheck.py", line 11, in <module>
name = input("What's your name? ")
File "<string>", line 1, in <module>
NameError: name 'test' is not defined
There's probably an easy solution for this, but I am really confused as I can't see anything visibly wrong with the code. Can anybody help me? I am running the code in Wingide Pro v6.1.2-1.
File "/Users/archie/Downloads/namecheck/namecheck.py", line 11, in <module>
name = input("What's your name? ")
File "<string>", line 1, in <module>
NameError: name 'test' is not defined
There's probably an easy solution for this, but I am really confused as I can't see anything visibly wrong with the code. Can anybody help me? I am running the code in Wingide Pro v6.1.2-1.
namework = 0 while namework == 0: name = input("What's your name? ") if len(name) > 10: ncwork = 0 while ncwork == 0: ncheck = input("Are you sure " + name + " is your name? Most names have between 3 and 10 characters. YES or NO ") ncheck = ncheck.lower() if ncheck == "yes": ncwork = 1 namework = 1 elif ncheck == "no": ncwork=1 elif len(name) < 3: ncwork = 0 while ncwork == 0: ncheck = input("Are you sure " + name + " is your name? Most names have between 3 and 10 characters. YES or NO ") ncheck = ncheck.lower() if ncheck == "yes": ncwork=1 namework=1 elif ncheck == "no": ncwork=1 else: namework=1