dimanche 28 octobre 2018

pycharm only activating first elif, ignoring others

# user input
num = int(input("Please enter engine size: "))

# calculations
if num <= 1000:
    print("The motor tax for your vehicle is €150")
elif num >= 1001 <= 1200:
    print("The motor tax for your vehicle is €175")
elif num >= 1201 <= 1400:
    print("The motor tax for your vehicle is €200")
elif num >= 1401 <= 1600:
    print("The motor tax for your vehicle is €250")
elif num >= 1601 <= 1800:
    print("The motor tax for your vehicle is €300")
elif num >= 1801 <= 2000:
    print("The motor tax for your vehicle is €350")
else:
    print("The motor tax for your vehicle is €500")

I know I've probably made a stupid mistake here, I'm just hoping someone could point me in the right direction. I'm trying to get PyCharm to print the relevant amount for each of the specified engine sizes. Each time I run it with any amount greater than 1000 it will only give me the output of €175. Thanks so much in advance!

Aucun commentaire:

Enregistrer un commentaire