+ 1
Where did I Go Wrong?
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
5 ответов
+ 2
Check the rounding requirement. The code needs to round up. The round() function that is used here rounds either up or down, depending on the value. There is a more appropriate function for rounding up.
+ 1
houses = int(input())
#your code goes here
x = round((2/houses)*100)
print(x)
0
Brian I don't know I was Doing Code Coach..
and I Come up With This Solution.....but idk Why. Only 2 output are Correct but Other were not
0
You can See it In My Profile....Code Coach Name candy
0
Brian is telling you to look for other functions instead of round() because it also rounds down - which is not what you want.