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 Python Basics Types and Branching If, Else and Elif

Jamaal Brown
seal-mask
.a{fill-rule:evenodd;}techdegree
Jamaal Brown
Python Web Development Techdegree Student 781 Points

SyntaxError: invalid syntax on line 3 with colon after "Craig": Code looks just like the screen.

Here is the line of code. Should be the same on the screen at 6:01

          <p>first_name = input("What is your first name?   ")
print("Hello,", first_name)
if first_name == "Craig":
   print(first_name, "is learning Python")
print("Have a great day {}!".format(first_name))</p>
          ```

1 Answer

Jamaal Brown
seal-mask
.a{fill-rule:evenodd;}techdegree
Jamaal Brown
Python Web Development Techdegree Student 781 Points

Strange. I retyped in the same line of code and it worked fine.

          <p>first_name = input("What is your first name?   ")
print("Hello,", first_name)
if first_name == "Craig":
   print(first_name, "is learning Python")
print("Have a great day {}!".format(first_name))</p>
          ```