+ 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.

2nd Sep 2020, 9:49 AM
Md. Ashraful Alam Emon
Md. Ashraful Alam Emon - avatar
4 Answers
+ 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))
2nd Sep 2020, 10:02 AM
Web-Learner
+ 2
Can you possibly show your attempt please?
2nd Sep 2020, 9:55 AM
Web-Learner
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
2nd Sep 2020, 10:00 AM
Md. Ashraful Alam Emon
Md. Ashraful Alam Emon - avatar
0
Thank you
2nd Sep 2020, 10:06 AM
Md. Ashraful Alam Emon
Md. Ashraful Alam Emon - avatar