-1

(MY CODE)`

o = [1,1,1,2,3,4]

if 99 and 98 or 97 and 96 in o:
    print("j")

#(OUTPUT)
j

why is output j? none of 99, 98, 97 or 96 is in o. even if i add parenthesis and "in o" after 99, 98 etc,

i still get same thing. im using vscode if it makes any difference

STOOKI
  • 1
  • That is not how you test multiple conditions – Pranav Hosangadi Dec 28 '22 at 03:16
  • Thank you very much pranav Hosangadi, this solution worked very well with the and operator but when I try something like o = [1,1,1,2,3,4] if all(x in o for x in [99,98] or [1,4]) == True: print("j") the output is nothin, so not "j", which I would think it should since 1 and 4 is in o. – STOOKI Dec 28 '22 at 03:38

1 Answers1

-1

condition1:99 and 98 = True

conditiuon2: condition1 or 97 = True

condition3:condition2 and 96 = True

conditon4:condition3 in 0 = True

if True: print("j")

Gluttony
  • 41
  • 2
  • Yes this solution is very good! I should be more specific with my question because I want all my conditions in one line if code if that is possible. – STOOKI Dec 28 '22 at 03:45