Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Gabriel
Python Web Development Techdegree Student 979 Pointsfor loop : I am using jupyter to solve problem 1 on for loop i received syntax error message below #columns: Nam
columns: Name, Day/month, celebrates, Age
BIRTHDAYS = ( ("James", "9/8", True, 9), ("Shawana", "12/6", True, 22) ("Amaya", "28/2", False, 8) ("Kamal", "29/4", True, 19) ("Sam","16/7", False, 22) ("Xan", "14/3", False, 34)
loop through all of the people in BIRTHDAYS
If they celebrate their birdays, print out
"Happy Birthday" and their name
print("Celebrations:")
File "<ipython-input-2-07c9ab09ba62>", line 12 print("Celebrations:") ^ SyntaxError: invalid syntax
InΒ [4]:
for person in BIRDAYS: if person [2] print("Happy Birthday, {}".format(person[0]))
File "<ipython-input-4-c68a16699937>", line 2 if person [2] ^ SyntaxError: invalid syntax
2 Answers
Mark Ramos
19,209 PointsIs it because you have a space in:
person [2]
Instead of:
person[2]
?
jb30
44,806 Pointsif person [2]
should be if person [2]:
with a :
at the end.