I was working with a for loop to make a super-simple program using for loops that asks you for your hobby three times and appends your answers to a list called hobbies:
hobbies = []
for me in range(3):
hobby=input("Tell me one of your hobbies: ")
hobbies.append(hobby)
If I, for example, give it 'coding', it will return:
Traceback (most recent call last):
File "python", line 4, in <module>
File "<string>", line 1, in <module>
NameError: name 'coding' is not defined
Note that if I use Python 2.7 and use raw_input
instead, the program works beautifully.