Determine whether integer is between two other integers
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Track title: CC I Beethoven Sonata No 31 in A Flat M
--
Chapters
00:00 Question
00:28 Accepted answer (Score 1476)
00:42 Answer 2 (Score 126)
00:53 Answer 3 (Score 68)
01:18 Answer 4 (Score 38)
01:51 Thank you
--
Full question
https://stackoverflow.com/questions/1362...
Accepted answer links:
[docs]: https://docs.python.org/3/reference/expr...
Answer 4 links:
[in the Python documentation]: http://docs.python.org/2/reference/expre...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
--
Track title: CC I Beethoven Sonata No 31 in A Flat M
--
Chapters
00:00 Question
00:28 Accepted answer (Score 1476)
00:42 Answer 2 (Score 126)
00:53 Answer 3 (Score 68)
01:18 Answer 4 (Score 38)
01:51 Thank you
--
Full question
https://stackoverflow.com/questions/1362...
Accepted answer links:
[docs]: https://docs.python.org/3/reference/expr...
Answer 4 links:
[in the Python documentation]: http://docs.python.org/2/reference/expre...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
ACCEPTED ANSWER
Score 1576
if 10000 <= number <= 30000:
pass
For details, see the docs.
ANSWER 2
Score 136
>>> r = range(1, 4)
>>> 1 in r
True
>>> 2 in r
True
>>> 3 in r
True
>>> 4 in r
False
>>> 5 in r
False
>>> 0 in r
False
ANSWER 3
Score 73
Use if number >= 10000 and number <= 30000:. Alternately, Python has a shorthand for this sort of thing, if 10000 <= number <= 30000:.
ANSWER 4
Score 40
To check that the number is in the range 10000 - 30000, use the Python interval comparison:
if 10000 <= number <= 30000:
print ("you have to pay 5% taxes")
This Python feature is further described in the Python documentation.