+ 1

in python 3 i don't understand This (or, and, not) please give me some examples also.

1) or 2) and 3) not

10th Jun 2019, 8:46 AM
Rupak Barman
Rupak Barman - avatar
4 odpowiedzi
+ 1
Or evaluates to True if one or both of the expressions are True - False or True ---> True - False or False ---> False - 6>7 or 7>6 ---> True And evaluates to True only if *both* expressions are True - True and True ---> True - False and True ---> True
10th Jun 2019, 8:49 AM
Trigger
Trigger - avatar
+ 1
Not returns the opposite of a boolean. "not True" becomes False
10th Jun 2019, 8:50 AM
Trigger
Trigger - avatar
+ 1
You can combine boolean expressions using "and", "or", and "not", which are the same as in the English language. The expression A and B is true if both A is true and B is true, and false if either is false. (For example, you get wet if it rains and you forgot your umbrella.) True and True - - - > True True and False - - - > False The expression A or B is true if either A is true or B is true, and false if both are false. (For example, school is closed if it is a holiday or it is a weekend.) True or True - - - > True True or False - - - > True False or False - - - > False The expression not A is true if A is false, and false if A is true. (For example, you are hungry if you have not eaten lunch.) not True - - - > False
10th Jun 2019, 8:52 AM
YWayne
YWayne - avatar
0
I will tell the true meaning of and, or and not, it may be more complex than it in action would be. and, or, not are logical operators. I will be talking about zero-values, with zero-values I mean any of 0, False, 0.0, None, empty lists [], empty strings "" and other empty iterables. x and y returns x, if x is any zero-value, otherwise it returns y. x or y returns y if x is any zero-value, otherwise it returns x. not x returns False if x is any non-zero-value, returns True if y is any zero-value.
10th Jun 2019, 11:09 AM
Seb TheS
Seb TheS - avatar