0

is the 'and' and the 'or' différent?

print (3==3 and 3 > 8) print (2!=2 and (24-5) == 19) print ("warrior" != "worrier" and 10==10) print ("feroce" == "faroce" or 34 != 34) hospital="18" hopital=21 print (int(hospital) > int(hopital) or 57 <= 100)

27th Sep 2016, 10:17 AM
Perroquet Charles
Perroquet Charles - avatar
4 odpowiedzi
+ 3
(a and b) is true if and only if a and b are both true. (a or b) is true if and only if at least one of them is true.
27th Sep 2016, 10:20 AM
Zen
Zen - avatar
+ 1
for "and" both condition should be true, for or at least one cond is true
2nd Oct 2016, 3:18 AM
James T Togara
James T Togara - avatar
+ 1
YES! Very much so! The 'and' operator requires all values ALL conditional statements to be true while the 'or' operator requires only ONE of the conditions to be true! Please note that hey can be used in conjunction (although from my experience it is rarely the best course of action). Make sure to get these down! They become very important in the future!
10th Oct 2016, 6:33 PM
irock2336
0
On your example. As i see 1 true and false=false 2 false and true=false 3 true and true=true 1 false or false=false 2 false or true=true
27th Sep 2016, 11:16 PM
Vladislav Savin
Vladislav Savin - avatar