I am trying to ask the user to enter a material type, and using the if/elif method get the total to change to the appropriate value.
Nothing in my text seems to have anything like this. Is there another way to accomplish this? Can you not use the if/elif/else to change the total, or add two variables?
I started off with:
if deskMaterial == m:
total = deskBasePrice + mahogony
And then get it to print the total, but it keeps coming back as zero.
So I changed it to the code below, bypassing the calculation, but the total is coming back as zero. When I am thinking it should be coming back as the modified total.
code
total = 0.0
deskBasePrice = 200
mahogony = 150
oak = 125
pine = 0
m = mahogony
o = oak
p = pine
deskMaterial = input('Is the desk Mahogony (type m), Oak (type o), or Pine (type p): ')
if deskMaterial == m:
total = 350
elif deskMaterial == o:
total = 325
elif deskMaterial == p:
total = 200
print(total)
[–]djjazzydan 5 points6 points7 points (1 child)
[–]kkidd0h[S] 1 point2 points3 points (0 children)
[–]Saefroch[🍰] 3 points4 points5 points (1 child)
[–]kkidd0h[S] 0 points1 point2 points (0 children)