0

Problem! Output is same everytime

https://code.sololearn.com/cCNGJ5Ii5aGj/?ref=app What I want is : If 11 & 12 standard is inputted then output is according to value of 'y' and if anything except 11 & 12 is given then I want the existing output which is being currently outputted in every condition

25th Jan 2019, 6:39 PM
Jay
Jay - avatar
2 Respostas
+ 5
"if (not x == 12 or not x == 11)" is always True. If x is 12, "not x == 11" is True and the whole expression is True. Same if x is 11. If x is neither 11 nor 12, "not x == 12" is also True and the whole expression is True again. If you want to check if x is neither 11 nor 12, use "if x != 11 and x != 12" or "if x not in (11, 12)".
25th Jan 2019, 8:33 PM
Anna
Anna - avatar
+ 1
Ah! Got it Thanks Anna
26th Jan 2019, 3:47 AM
Jay
Jay - avatar