[For your hobbies] What is wrong with my code?


#1

My code is as the following. Anyone could tell me what’s wrong with my code? It shows an syntax error. Thank you!

hobbies = []

i = 1
for i < 4:
hobby = raw_input("Tell me one of your favorite hobbies: ")
hobbies.append(hobby)
i += 1

print hobbies


#2

for i < 4: is not a valid construction, if you want a for loop with a certain amount of iterations, use range() or use a while loop


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.