Reputation: 53
Basically, I want to be able to have an input where if a number is between 2 numbers, such as if a number is between 2-8 , it prints "Confirmed.", So if the input is 4,5,6,7 or 8 it will do that.
I've tried this code only, because I couldn't think of anything else.
if Distance > 1 and < 9:
print("You should ride your bike.")
I want it to print out "You should ride your bike" if the inputted number is between 2 and 8.
Upvotes: 5
Views: 185
Reputation: 125
i].you can use and
operator
if Distance > 1 and Distance < 9:
print("You should ride your bike.")
ii].Simple one
if 1 < Distance < 9:
print("You should ride your bike.")
Upvotes: 1
Reputation: 71610
You have to do:
if 1 < Distance < 9:
print("You should ride your bike.")
Upvotes: 5