+1

# Whole Test Case

I'm having troubles for the code of Halloween I visit at least 3 houses and 2 of them give me a dollar. So I have to calculate the percentage of that depending the number of houses. For equal and bigger than 3 the code is running well. In the other cases not. houses = int(input()) if houses>=3: percentdollars=round((2/houses)*100) print(percentdollars) else: if houses==2: percentdollars=round((1/houses)*100) print(percentdollars)

4/4/2021 12:29:54 AM

Felipe Osorio

+3

Output should be rounded up to the nearest integer. So you need to use ceil() instead of round () import math houses = int(input()) if houses>=3: percentdollars=math.ceil((2/houses)*100) print(percentdollars) else: if houses==2: percentdollars=math.ceil((1/houses)*100) print(percentdollars)

+2

+2

Idkn where I got 200 houses, but code is worked ðŸ¤­

+1

+1

don't we have to take 200 houses into account?

+1

Just say the condition that I mentioned right up.

+1

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

+1

+1

I can lead you to the solution of four tests. one test does not pass and I have

+1

Test Case 1 and 2 are solved but I can't see what I'm missing to solve the other Test Cases

+1

I have two codes that fail test #4. where do we start?

+1

+1

houses = int(input()) #your code goes here percent = 200 // houses if houses > 200: print(1) elif houses % 2 == 0: print(percent) else: print(percent + 1)

+1

Thanks

+1

Thanks? You pass all tests?

0

your code passes only two tests

0

import math houses = int(input()) ratio = 200 / houses print (math.ceil( ratio )) Simple code

0

Hi.

0

i m. tusher. nice. too meet you. bro

0

Test
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}