0
Why it is not working for else??
input () hi=True hello=True Hi=True Hello=True if True: print ("Hello sir how can I help you") else: print ("Sorry for inconvinence sir ,please put something valid") input ()
6 Answers
+ 3
Is this what you were trying to achieve.
greeting = input()
greetings = ['hi','hello','Hi','Hello']
if greeting in greetings:
print ("Hello sir how can I help you")
else:
print ("Sorry for inconvinence sir ,please put something valid")
You needed to create a valid input and refer it to a list of acceptable responses to activate your if / else conditions
+ 4
Dedipyaman Bhattacharjee
What you actually want to achieve with this.
Since you have given the condition as true in the if statement that means that it will always execute only the if part and never the else part.
It you write *if False:* then it will always execute the else part because the condition is false
+ 1
Thanks
0
So what should be given