Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python

Please I need help Using the if statement, is there a way to write that a number is shouldn’t be less than or equal to a number and also greater than or equal to another number The translation of 5<x<10 in python

22nd Oct 2021, 9:43 PM
Oyetubo Oreoluwa
8 Answers
+ 1
The translation of 5<x<10 in python is 5<x<10 e.g.: if 5<x<10: pass
22nd Oct 2021, 11:42 PM
Angelo
Angelo - avatar
+ 1
Ore, in python there is statement "not" which is used to return True if statement after it is false. It could be used as follows: if not (5<=x<=10): There is also mistake in your question. <= is used for less or equal rather than < In addition to share code on sololearn, you could either go to your code and press on share button(top-right) and copy link, or if you are typing a message/comment, there is a (plus) button on the right, near (send) button. Press it, and then choose "Insert Code"
23rd Oct 2021, 1:03 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 1
Use the and operator x<=5 and x<=10.
24th Oct 2021, 9:29 AM
Ibrahim Aminu
Ibrahim Aminu - avatar
0
if 5<x and x<10:
22nd Oct 2021, 9:54 PM
Kamil Hamid
Kamil Hamid - avatar
0
It didnt work
22nd Oct 2021, 9:56 PM
Oyetubo Oreoluwa
0
If it is greater of equal to then it should be: if x>=5 and x<=10:
22nd Oct 2021, 10:01 PM
Kamil Hamid
Kamil Hamid - avatar
0
I’m new to this so i dont know how i’m supposed to share the code
22nd Oct 2021, 10:04 PM
Oyetubo Oreoluwa
0
Thank you so much I’ve seen my mistake
23rd Oct 2021, 8:23 PM
Oyetubo Oreoluwa