Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make something print if the input is a number is between 2 different numbers?

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.

like image 743
OpBanana Avatar asked Aug 07 '19 04:08

OpBanana


1 Answers

You have to do:

if 1 < Distance < 9:
    print("You should ride your bike.")
like image 88
U12-Forward Avatar answered Sep 27 '22 21:09

U12-Forward