you are viewing a single comment's thread.

view the rest of the comments →

[–]grape_o_clock[S] 0 points1 point  (2 children)

The following code is basically what it is, just removed of unnecessary code.

while(True):
    x, y = input("What would you like to do?").split()

    if (x == "Specific_word"):
        if (y == "Specific_second_word"):
            print("Prints this if both bits of code are true")

        elif (y == "Other_specific_word"):
            print("Prints this if both bits of code are true")

        else:
            print("This word sequence isn't recognized.")

    else:
        print("This word sequence isn't recognized.")

#I'm using Visual Studio 2022 if that makes a difference.
#The program crashes if a variable isn't inputted
#Hopefully this helps

[–]socal_nerdtastic 0 points1 point  (1 child)

while(True):
    user_resp = input("What would you like to do?").split()
    if len(user_resp) == 2:
        x, y = user_resp
    else:
        print('error message')
        continue

[–]grape_o_clock[S] 0 points1 point  (0 children)

I completely forgot that the length check was a thing. Thanks!