Working with if statements and multiple conditions unexpected output /u/FeedMeAStrayCat Python Education

Hi All,

I am running into a problem with this code, if I enter “Thomas” as the input I am getting the output “I think you might be one of Donald Duck’s nephews.”. It should be outputting the else statement. I think my syntax is correct, what am I missing? Has to be something simple, yet I can’t find it.

name = input("Please type in your name:")
if name == "Huey" or "Duey" or "Louie":
print ("I think you might be one of Donald Duck's nephews.")
elif name == "Morty" or "Ferdie":
print ("I think you might be one of Mickey Mouse's nephews.")
else:
print ("You're not a nephew of any character I know of.")

submitted by /u/FeedMeAStrayCat
[link] [comments]

​r/learnpython Hi All, I am running into a problem with this code, if I enter “Thomas” as the input I am getting the output “I think you might be one of Donald Duck’s nephews.”. It should be outputting the else statement. I think my syntax is correct, what am I missing? Has to be something simple, yet I can’t find it. name = input(“Please type in your name:”) if name == “Huey” or “Duey” or “Louie”: print (“I think you might be one of Donald Duck’s nephews.”) elif name == “Morty” or “Ferdie”: print (“I think you might be one of Mickey Mouse’s nephews.”) else: print (“You’re not a nephew of any character I know of.”) submitted by /u/FeedMeAStrayCat [link] [comments] 

Hi All,

I am running into a problem with this code, if I enter “Thomas” as the input I am getting the output “I think you might be one of Donald Duck’s nephews.”. It should be outputting the else statement. I think my syntax is correct, what am I missing? Has to be something simple, yet I can’t find it.

name = input("Please type in your name:")
if name == "Huey" or "Duey" or "Louie":
print ("I think you might be one of Donald Duck's nephews.")
elif name == "Morty" or "Ferdie":
print ("I think you might be one of Mickey Mouse's nephews.")
else:
print ("You're not a nephew of any character I know of.")

submitted by /u/FeedMeAStrayCat
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *