Checking the sum of response proportions
Write code · Medium · §5.4 Floats are approximations
The survey response proportions agree, disagree, and unsure must add up to 1. Store True in valid if the sum of the three proportions equals 1, and False if it does not. To ignore tiny floating-point errors, round the sum to two decimal places before you compare.
Starter code
agree = 0.6
disagree = 0.3
unsure = 0.1Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.