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 trial

Python Introducing Lists Using Lists Split and Join

Caleb Hughes
Caleb Hughes
904 Points

Syntax 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

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)

I have solve your problem. You can make two mistake that I am correcting now

  1. first on is parenthesis. In the print function or print line at the end you cannot add an parenthesis )
  2. 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.

It is difficult to read your code, because you forgot to provide markdown (read the Markdown Cheatsheet below the answer box :arrow_heading_down:), but I think you are missing a closing parenthesis on the first print statement.