0
What are theas things for
In python i know <= and => are important But i don't know how to use them Please help me
5 Respostas
+ 3
《 Nicko12 》 You only get that answer if you use 3 "if"s. If you use "if" and 2 "elif"s, the last test is skipped if the second test is True. 🙂
+ 2
>= is Greater than OR Equal to
<= is Less than OR Equal to
They are used if you want to include that number in logical operations (inclusive)
x = 5
if x > 5:
print("One")
if x >= 5:
print("Two")
if x == 5:
print("Three")
>>>Two
Three
+ 2
David Ashton Thank you for correction!!😁 I didn't think of that.😅
+ 1
Yes you can implement 3 ifs to get the answer for your question as David Ashton said. But i will answer your question to help you to get a better understanding of this.😀
<= and >= are compound operators. They are the result of these ones <, =, >. And are shortcuts for:
✳ some_value < value or some_value == value
and
✳ some_value > value or some_value == value
0
They're comparisons operators they are to check the condition.
They will return only true or false
For example if you want to check that 5 is smaller than 6 so you can use >= it will give you true coz 5 is smaller than 6