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

err

first_name = input("what is your first name? ") print("Hello,", first_name) if frist_name == "Craig": print(first_name, "is learning python") elif first_name == "shmulik": print(first_name, "is learning here me too")
else: print("you should totolly learn python, {}!".format(first_name)) print("have a great day, {}!".format(first_name)) {}!".format(first_name)) THIS COMES AS ERR it askes my name then anything i put after comes as a err

1 Answer

Fergus Clare
Fergus Clare
12,120 Points

Hello shmuel zilberman! Great question. The reason you're getting an error is because your code includes two formatting additions to the string in the last else statement. Try changing your code from this:

first_name = input("what is your first name? ") 
print("Hello,", first_name) 

if frist_name == "Craig": 
   print(first_name, "is learning python") 
elif first_name == "shmulik": 
   print(first_name, "is learning here me too")
else: 
   print("you should totolly learn python, {}!".format(first_name)) 
   print("have a great day, {}!".format(first_name)) {}!".format(first_name)) 

to this:

first_name = input("what is your first name? ") 
print("Hello,", first_name) 

if frist_name == "Craig": 
   print(first_name, "is learning python") 
elif first_name == "shmulik": 
   print(first_name, "is learning here me too")
else: 
   print("you should totolly learn python, {}!".format(first_name)) 
   print("have a great day, {}!".format(first_name)) 

Notice how in the last line above, we removed the second instance of the {}!".format(first_name). Also, adding your code in Markdown format will ensure you get responses faster going forward as it makes your code easier to read. Great job on this and keep it up! We believe in you!