Jun-22-2022, 05:35 PM
(This post was last modified: Jun-22-2022, 05:35 PM by deanhystad.)
If you understood the problem well enough to explain it well you probably wouldn't have the problem in the first place. The catch-22 of programming is you don't know enough to know what it is that you don't know.
Think about the order of your comparisons. If a number is greater than 250 it is also greater than 100. If you first check if it is greater than 100, that test is going to succeed.
The exit() function is not meant to compensate for the programmer not knowing how to write an if statement. Read up on the if statement (if, elif, else) and you will see exit() is not needed for your program.
This is repeated multiple times to make up much of of the code in your program:
Think about the order of your comparisons. If a number is greater than 250 it is also greater than 100. If you first check if it is greater than 100, that test is going to succeed.
The exit() function is not meant to compensate for the programmer not knowing how to write an if statement. Read up on the if statement (if, elif, else) and you will see exit() is not needed for your program.
This is repeated multiple times to make up much of of the code in your program:
bulk_discount=(round(float(amount_of_cable)*0.80,2)) print(bulk_discount) input("prompt")If you buy a lot of cable or very little the equation does not change. It is always bulk_discount = quantity * discount. The only difference between different incarnations is the discount number (0.8, 0.7, 0.5). You should limit your if statement to only setting the "discount" and then printing the bulk discount after the if statement. Your program should be about a dozen lines long.