What are theas things for | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

13th Dec 2020, 4:39 AM
Kalindu Thathsara
Kalindu Thathsara - avatar
5 Answers
+ 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. 🙂
13th Dec 2020, 6:35 AM
David Ashton
David Ashton - avatar
+ 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
13th Dec 2020, 4:43 AM
noteve
noteve - avatar
+ 2
David Ashton Thank you for correction!!😁 I didn't think of that.😅
13th Dec 2020, 6:36 AM
noteve
noteve - avatar
+ 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
13th Dec 2020, 8:53 AM
Hacker-KR4636
Hacker-KR4636 - avatar
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
13th Dec 2020, 1:37 PM
Anjali Patel
Anjali Patel - avatar