PythonCookAll activities
Tier 2 · Refactor the AI's code

Refactor the shipping fee

Refactor the AI's code

Make the tests pass and clean up the repeated conditions.

An AI wrote shipping(weight). Rules: 0 or less is free; up to and including 5 costs 3; up to and including 20 costs 8; over 20 costs 15. It has one wrong boundary and the conditions repeat themselves. Fix both.

solution.py
Loading...
starting...

Run your code to see its output here.

Make the tests pass AND clean it up. Cleanliness is checked too.