Question: I use python to write program, and my professor gave me this common: Mixture of relational operator( ) in if elif is not acceptable. Do
I use python to write program, and my professor gave me this common:
Mixture of relational operator(<, >) in if elif is not acceptable.
Do you really need last elif? Instead use else.
Percentage is not displayed as .35 its 35%.
My syntax is written like:
if user_unit_purchase < 10:
discount = 0
elif user_unit_purchase < 20:
discount = 0.20
elif user_unit_purchase < 50:
discount = 0.30
elif user_unit_purchase < 70:
discount = 0.35
elif user_unit_purchase < 100:
discount = 0.40
elif user_unit_purchase > 100:
discount=0.50
How could I improve my syntax according my professor's common?
THX
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
