+ 1
Can anyone explain it?
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. 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.
4 Réponses
+ 1
Md. Ashraful Alam Emon
"""In the passage says that ROUND UP to the whole nearest number,so
if-else statements are useless here. """
from math import ceil
houses=int(input())
percentage=200/houses
print(ceil(percentage))
+ 2
Can you possibly show your attempt please?
0
import math
houses = int(input())
houses = houses % 4
if houses >=3:
dollars=houses-1
percentage= ((dollars /houses)*100)
percentage = round(percentage )
print (percentage )
else:
dollars = houses - 1
0
Thank you