Chandler Manuel
Chandler Manuel

Reputation: 11

How do I create an if statement requiring a specific range of numbers from input

Inside of this code you can see that I am creating a system where by checking the users credit score the base price of the property will change. Obviously I can't implement the discount prices because I can't create an if statement for those with a credit of 670 through 850. Please give suggestions.

# Prompt section for customer
credit_check = '''The listing of this property is currently at $1,000,000.
In order to continue you must participate in a credit check that will evaluate your options of payment.'''
print(credit_check)
answer = input('Would you like to continue on to the credit check?(yes or no) ')

# Results of Prompt
if answer == "yes":
    credit = input('Please enter your credit score ranging 300 through 850: ')
elif answer == "no":
    print('''Unfortunately we can not serve you unless you provide a credit check
    ,thank you. 
    Chandlers Estate Co.''')

# This is the piece of code that I'm stuck on.
if int(credit) ==  :
    print("hi")

Upvotes: 0

Views: 48

Answers (1)

Yenz1
Yenz1

Reputation: 94

If you want to check for a "credit" between 2 numbers use code below. You can use > to see if it's higher than x and < to check if it's lower than x. You can also use >= to check if that number is x or higher than x

 if credit >= 670 and credit <= 850:
      print("hi")

Upvotes: 0

Related Questions