help me out. ...what to do with no output | Sololearn: Learn to code for FREE!

+1

# help me out. ...what to do with no output

Halloween Candy +10 XP 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. Sample Input 4 Sample Output 50 my code: from math import * houses = int(input()) if houses>=3: a=((2/houses)*100) print(int(round(a)))

5/16/2020 5:22:40 AM

Akshat Jain

+3

In Output it says the result should be rounded *up* to the next integer. You round mathematically.

+1

Lisa i am still having a problem houses = int(input()) if houses>=3: a=((2*100)//houses) print(a+1) what should i do to print 20 when ipput is 10... and i am having the output 21

+1

I think your approach in the description was already fine. The only thing you woul need to change is the round function. Instead of round(), you could use ceil() from the math module.

0

oh thnx

0

Lisa thnxðŸ¤˜