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

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!