Python Forum
Check if integer is between two values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if integer is between two values
#3
Your problem is that the two if-statements are independent of each other. You're basically saying "if x <= 3 do something" then you say "if x >=8 then do another thing, otherwise do some third thing." It's subtle but you should notice that I intentionally grouped your if statements into two independent questions.

Take a look at this: https://docs.python.org/3/tutorial/contr...statements

Also, please put your code inside python tags so it gets nicely formatted.
this:
if x >= 3:
    print("x is less than three")
instead of:
if x >= 3:
print("x is less than three")
Reply


Messages In This Thread
RE: Check if integer is between two values - by mpd - Dec-24-2017, 01:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Iterating over pandas.df to check for values out of range Padowan 14 12,694 Nov-26-2017, 04:37 PM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020