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


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: ")
i += 1

print hobbies


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


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