0
Halloween candy
Task Given the input of the total number of houses that you visited, what is the percentage chance that one random item pulled from your bag is a dollar bill? Input Format An integer (>=3) representing the total number of houses that you visited. Output Format A percentage value rounded up to the nearest whole number. Sample Input 4 Sample Output 50 My answer: houses = int(input()) pc = (2*100)/houses pcr = round(pc) print(pcr) Why it dont work? 😭
4 Antworten
+ 7
Have a close look at the output format: You are supposed to round ***up*** to the nearest whole number.
+ 3
To roundup a number, you need the math library.
Take some time to research how to import library and how to use them.
+ 2
The text:
"You go trick or treating with a friend and all but three of the houses that you visit are giving out candy. One house that you visit is giving out toothbrushes and two houses are giving out dollar bills."
+ 1
Needed to roundup , if you're using c++ use <cmath> library