0
Why am I getting the output as "hello" why not "bey" because "a" value is not equal to either "A" or "a"
a = "H" if a == "A" or "a": print("hello") else: print("bey")
2 odpowiedzi
+ 4
You need to use;
if a == "A" or a == "a":
or "a" will return a truthy result as a non-empty string is truthy. You need to have an expression on each side of an 'or'/'and' that can be evaluated.
+ 2
because you must write:
if a == "A" or a == "a":
alternativaly you could write too:
if a in "Aa":