0
Have anyone solved this code coach problem? I know its easy but last 3test cases are not getting approved. Kindly check code
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. Code: houses=int(input()) print(round(200/houses))
15 Respostas
+ 3
round will round to the nearest whole number. you will need to use math.ceil to always round up to the nearest whole number.
example:
math.ceil( ( 2 / houses ) * 100 )
+ 2
No ceil will round off to it's highest near integer. Ex- 5.3, using ceil function u can turn it into 6 but using round of function u can turn it into 5
+ 2
Please kindly post your code here
+ 1
Post your code here
+ 1
For me it loads an error saying math function undefined and round still hasn't solved the problem
+ 1
Ehizzy Ebson first import math module----import math...then apply math.ceil()
0
Andrew Choi Done, thanks bro
0
But round() and math.ceil() both will round to the nearest whole no. Right?? Then y did we used math.ceil()
0
Atul ohh...ohkkk..thanks
0
Harshita Sharma my pleasure
0
Iutsavsingh it's done..but thanks😊
0
Math.ceil() function is used to round up a number,not round figure the number .
suppose,8.1 is a number then 9 is the round up of 8.1
0
Hi
0
😘