dimanche 22 avril 2018

Skipping if statments in Python

I created nested conditions in my lines of code, but I can't seem to skip them if I input anything.

condition = input("What is the condition of the book? ")
age = input("Is the book old or new? ")
cover = input("What type of cover does it have? ")


if condition == "good":
    if age == "new":
        if cover == "hardcover":
            print("We can offer you a high price")
        elif cover == "papercover":
            print("We can offer you a medium price")
    elif age == "old":
        print("We can offer you a medium price")
elif condition == "poor":
    print("We can offer a low price")
elif condition == "terrible":
    print("Sorry we cannot accept this book")
else:
    print("I do not understand, please leave the store")

Aucun commentaire:

Enregistrer un commentaire