samedi 29 avril 2017

IF, ELIF, ELSE and OR with Python, not working

I´m trying to make this simple project work but is not working at all, i don´t know the if statement with the: if name == " Cher " or name == " Madonna ": print ("May I have your autograph please?"), is not working. I tried a lot of combinations and when I digit Jansen as the name it goes to the correct print, and also another name not listed, but when I put Cher or Madonna it goes to the print of the Else statement. Could someone help me to see what is wrong? I´m using the Python IDLE and Python Shell to run it. Thanks in advance.

password = input("Digit the password: ")

while password != "hello":
   password = input("Digit the password: ")

if password =="hello":
   print ("Welcome to the second half of the program!")
   name = input("What is your name?")

   if name == " Cher " or name == " Madonna ":
         print ("May I have your autograph please?")

   elif name == "Jansen":
         print ("What a Great Name")

   else :
        print (name, "that's a nice name.")

Aucun commentaire:

Enregistrer un commentaire