Hi, can you explain why in the code the line is:
for num in range(3) - where does num come from? Why is it not for hobbies or for hobby in range(3)?
The num seems so random and out of nowhere!
because hobby or hobbies doesn’t accurately describe what the variable will hold. Giving logic variable makes code a lot more readable. Given range produces numbers/integers, num is a fair name.
I’m starting to get very frustrated. My code is exactly the same as the answer except for the string asking about your hobby. Surely CodeAcademy should count this as right since they do not tell you specifically what to put in the prompt?
Or is there something wrong with this I’m not seeing? I keep getting the error that the program took too long to terminate. Please help.
hobbies = []
# Add your code below!
for num in range(3):
hobby = raw_input("What's your hobby?: ")
hobbies.append(hobby)
print hobbies
In the Python 2 track, raw_input() does not work. If you search the forums you will find this mentioned in numerous places, as well as how to work around it so you can see your code run.