0

I'm trying to create a simple, veery simple bot. But its All messed up, pls help


inp = input('')
if inp == ('Hello' or 'hello' or 'hi' or 'Hi'):
    inp1 = input('Hello, How are you? \n')
else:
    sys.exit('hmmm')

if inp1 == "I'm Fine" or "i'm fine" or "i'm Fine" or "I'm fine" or "fine" or "Fine":
    input("Cool, Wassup? \n")
elif inp1 == "not fine" or "Not Fine" or "not Fine" or "Not fine":
    inp3 = input("Why?\n")
else:
    sys.exit("hmmm")
if inp3 == str:
    print("Lmao")
else:
    print('wut?')
if inp2 == str:
    print('Noice')

2 Answers2

0

or is applied between logical values, such as:

inp == "Hello" or inp == "hello"

However, you can also achieve what you want using the in operator, which checks if a value is in a list

inp in ('Hello', 'hello', 'hi', 'Hi')

But even better, given that you seem to want to do this case-insensitive, you can make the input lower case, and only match lower case values

inp.lower() in ('hello', 'hi')
tituszban
  • 4,797
  • 2
  • 19
  • 30
0

The or operator gets the first "truthy" value (roughly, non- zero non-empty), so

if inp == ('Hello' or 'hello' or 'hi' or 'Hi'):

is equivalent to

if inp == 'Hello':

What you probably want is:

if inp in ('Hello', 'hello', 'hi', 'Hi'):
Jiří Baum
  • 6,697
  • 2
  • 17
  • 17