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)
4 Respostas
+ 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.
+ 1
for "and" both condition should be true, for or at least one cond is true
+ 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!
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