+ 1

If I type 7 >= 3, then also output is True. What is the logic here?

Output of 7 > 3 is True which is understandable but why it should be True for 7 >= 3 as well?

27th Mar 2017, 6:22 AM
deepak deo
deepak deo - avatar
4 Antworten
+ 7
Because >= check if > OR = is true, in your both case 7 is still > than 3 so it's a match.
27th Mar 2017, 6:26 AM
Geoffrey L
Geoffrey L - avatar
0
>= will check if the first number is more than or equal the second number If x>3 --> return True if x is 4,5,6,... If x>=3 --> return True if x is 3,4,5,.... So 7>=3 will return True
27th Mar 2017, 7:23 AM
Moataz El-Ibiary
Moataz El-Ibiary - avatar
0
Thanks Geoffrey. I understood, even if one condition is True, output will be True.
27th Mar 2017, 12:57 PM
deepak deo
deepak deo - avatar
0
It is more than 3 Like: if 7 == 3: return True elif 7 > 3: return True else: return False
13th Apr 2017, 8:44 AM
Niatoos