mercredi 14 mars 2018

IF Statement gaps

I have a typical nested if-elif block of python code. Why does my output require the input be entered multiple times before returning the next statement?

Var = str(input("Type in a greeting: "))
if Var.upper().lower() == "Hello".upper().lower():
    input("Hello there! How are you doing? ")
    if input().upper().lower() == "Good".upper().lower():
        exit("Thats Great! Have a good day. ")
    elif input().upper().lower() == "Bad".upper().lower():
        input("What's wrong? ")
elif Var.upper().lower() == "Hi".upper().lower():
    print("Hi there!")
elif Var.upper().lower() == "Hey".upper().lower():
    print("Hey there!")

Here is the output:

Type in a greeting: hello
Hello there! How are you doing? bad
bad
bad
What's wrong? 

Aucun commentaire:

Enregistrer un commentaire