Python Forum
A three if statement problem I am having - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: A three if statement problem I am having (/thread-13805.html)



A three if statement problem I am having - WarblingPasta - Nov-01-2018

When I run it I have the problem in which the overall price always calculates as if the carpet is basic, so if I choose a luxury carpet the carpet price will be the same as if I have chosen basic. I have asked my teacher for help and they are unsure

This is my code:

#oneSquareMetre fitting price = £3.75
#One Square metre of basic is £6.50
#One Square metre of standard is £18.75
#One Square metre of luxury is £29.50


oneSquareMetre = float(3.75)
print ("What type of Carpet do you want?")
TypeOfCarpet = input()
print ("What is the size of the room in Square Metres")
SizeOfRoom = float(input())
FittingPrice = float(oneSquareMetre * SizeOfRoom)
print ("Your fitting price in GBP is")
print (FittingPrice)
print ("Your overall price in GBP is")
if ((TypeOfCarpet) == ("basic") or ("Basic")):
    CarpetCost = ((6.50) * SizeOfRoom)
    print (CarpetCost + FittingPrice)
    #print ((float(6.50) * SizeOfRoom))
    
elif ((TypeOfCarpet) == ("standard") or ("Standard")):
    CarpetCost = ((18.75) * SizeOfRoom)
    print (CarpetCost + FittingPrice)
    #print ((float(6.50) * SizeOfRoom))
    
elif ((TypeOfCarpet) == ("luxury") or  ("Luxury")):
    print ((float(29.50) * SizeOfRoom))



RE: A three if statement problem I am having - j.crater - Nov-01-2018

You will most likely find the answer in this tutorial on our forums.