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 trialCaleb Hughes
904 PointsSyntax Error In "To" and "CC" Split
attendees = ["Ken", "Alena", "Treasure"] attendees.append("Ashley") attendees.extend(["James", "Guil"]) optional_invitees = ["Ben", "Dave"] potentional_attendees = attendees + optional_invitees print("There are", len(potential_attendees), "potential attendees currently."
to_line = ", ".join(attendees) cc_line = ", ".join(optional_invitees) print("to: " + to_line) print("cc: " + cc_line)
treehouse:~/workspace$ python meeting.py
File "meeting.py", line 8
to_line = ", ".join(attendees)
^
SyntaxError: invalid syntax
2 Answers
omair qasim
Python Web Development Techdegree Student 137 Pointsattendees = ["Ken", "Alena", "Treasure"]
attendees.append("Ashley")
attendees.extend(["James", "Guil"])
optional_invitees = ["Ben", "Dave"]
potentional_attendees = attendees + optional_invitees
print("There are", len(potential_attendees), "potential attendees currently."
to_line = ", ".join(attendees)
cc_line = ", ".join(optional_invitees)
print("to: " + to_line)
print("cc: " + cc_line)
I have solve your problem. You can make two mistake that I am correcting now
- first on is parenthesis. In the print function or print line at the end you cannot add an parenthesis )
- Second one is you make mistake in len(potential_attendees) the spell is false. Now i am correcting this.
attendees = ["Ken", "Alena", "Treasure"]
attendees.append("Ashley")
attendees.extend(["James", "Guil"])
optional_invitees = ["Ben", "Dave"]
potentional_attendees = attendees + optional_invitees
print("There are", len(potentional_attendees), "potential attendees currently.")
to_line = ", ".join(attendees)
cc_line = ", ".join(optional_invitees)
print("to: " + to_line)
print("cc: " + cc_line)
hop now you understand your mistakes.
Alexander Davison
65,469 PointsIt is difficult to read your code, because you forgot to provide markdown (read the Markdown Cheatsheet below the answer box ), but I think you are missing a closing parenthesis on the first print
statement.