dimanche 30 août 2020

My if else statement only goes to print out the 'if' section [duplicate]

I'm learning python by myself with youtube and I'm playing around with it. It's been about 2 weeks. Then I suddenly wanted to make a silly multi-ending mini game using my brother with if else statement. But it only goes to print out the 'if' section even if I input words like 'no' or anything else.

# Project: Hit & Run David


from time import sleep


def print_slowly(num_fullstop):
    for _ in range(num_fullstop):
        print(".", end='')
        sleep(1)


print("Welcome to Hit & Run Simulator!")
sleep(2)
hit_or_not = input("Would you like to hit David without any reason? ")
if hit_or_not == "yeah" or "yes" or "sure" or "of course" or "okay" or "indeed" or "yup" or "ya":
    sleep(1)
    print_slowly(3)
    print()
    print("David is now angry!")
    sleep(2)
    calm_or_not = input("Would you like to try calming him down? ")
    if calm_or_not == "yeah" or "yes" or "sure" or "yep" or "ok" or "okay" or "yup" or "ya":
        sleep(2)
        print("You said to David: 'I'm sorry bro!'")
        sleep(2)
        print("'It was just a physical friendly greeting! Calm down!'")
        sleep(1)
        print_slowly(3)
        print()
        print("David is calmed down now.")
        sleep(1)
        print_slowly(6)
        print()
        hit_or_not = input("Would you like to hit David again? ")
        if hit_or_not == "yeah" or "yes" or "sure" or "ok" or "yep" or "okay" or "yup" or "ya":
            sleep(2)
            print("You just hit David again!")
            sleep(2)
            print("Now he is so mad that trying to calming him down won't help!")
            sleep(4)
            run_or_not = input("Would you like to run away? ")
            if run_or_not == "yeah" or "yes" or "sure" or "ok" or "yep" or "okay" or "yup" or "ya":
                sleep(2)
                print("You start to run away as fast as you can.")
                sleep(4)
                print("David starts to chasing you but he is much slower than you so you safely escape from him.")
                sleep(8)
                print("HAPPY ENDING")
            else:
                sleep(4)
                print()
                print("So you have chosen death.")
                sleep(4)
                print()
                print("BAD ENDING 2")
        else:
            print("Ok, fair enough")
            sleep(4)
            print()
            print("Normal ENDING")
    else:
        print("David became so angry now that he starts to beat you")
        sleep(4)
        print("You were beaten up to death.")
        sleep(4)
        print("BAD ENDING")
else:
    print("You are so BORING.")
    sleep(4)
    print("KINDA HAPPY ENDING")

Aucun commentaire:

Enregistrer un commentaire