Python Python Basics Types and Branching If, Else and Elif

Yahya Alshwaily
Yahya Alshwaily
Python Development Techdegree Student 2,457 Points

If and else statements are both true


if I input yahya both "is learning python" and "you should definetly learn python" statements appear in the console, could anyone please explain to me where I went wrong?


First_name = input("Hello, What's your name?")

if First_name == "yahya":

print(First_name, " is learning python")

elif First_name == "gleb":

print (First_name, " is learning python")


print ("you should definetly learn python {}".format(First_name))

print ("have a good day {}".format (First_name))

// thank you!

It seems like an indentation issue, make sure your indentation of else is proper.

1 Answer

Steven Parker
Steven Parker
201,975 Points

As suggested by boi, an indentation error could cause your issue.
For us to be able to see the code as it really is, use Markdown formatting when posting to the forum.