0

I don't know how exactly to word it so ill just explain,

elif careful != "yes"  "no":

How do i make the "yes" and "no" independent? When i put it in, it combines the "yes" and "no" together.

Output

'yesno'

I have tried using the '|' operator and the '&' operator

Here is the full code

 careful = input("Are you Careful?")

if careful == "yes":
    print("ok good, what is your age?")
    age = int(input("Your age?"))
    if age <= 13:
        print("sorry, paws is hiding")
    elif careful != "yes" "no":
        print("nonsense, say yes or no")
    else:
        print("Be careful! she nibbles, with no teeth")
else:
    print("you have to be careful!")

thanks

1 Answers1

0

Instead of,

elif careful != "yes"  "no":

You can use

elif careful not in ("yes" , "no"):
kindall
  • 178,883
  • 35
  • 278
  • 309
Rahul K P
  • 15,740
  • 4
  • 35
  • 52