← Back to If Statements
Question 239
Shipping Cost By Weight
Shipping Cost By Weight
Read a parcel weight in kilograms and print the shipping cost in the form Shipping: <cost>: up to 1 kg costs 5, up to 5 kg costs 10, up to 20 kg costs 20, and heavier parcels cost 50. Store the cost in a variable chosen by an if / elif / else chain, then print once at the end. Input: one line, the weight as a decimal number, no prompt. Output: one line.
Expected Output:
Shipping: 5= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.