0
Halloween Candy
houses = int(input()) dollar = 2 if houses >= 3: print (int(dollar/houses*100)) How to round the output format? That is, round up percentages.
10 Answers
+ 6
Rounding **up** (!!!) can be achieved with the ceil() function from the math module.
+ 5
I mean, for this task it is not necessary to check if houses >= 3 because it is defined that it will only ever be >= 3.
+ 4
Read the task description carefully: You are supposed to *round up*. And what happens when one inputs less than 3 houses?
+ 2
С A use ceil()
+ 1
how to round percentages?
+ 1
Looks like I haven't explored this section yet, thanks for the help.
+ 1
С A Use round(num, decimals) function.
Example:
round(3.6184, 2) -> 3.62
round(381.837837, 3) -> 381.838
+ 1
Thanks, I haven't taken the function courses yet, so I can't solve this problem.
+ 1
The task description asks us to ROUND UP, not to ROUND. Note the "up".
0
it is not indicated what to do if there are fewer houses