+ 2
Is this a valid solution for the Halloween candy problem from code coach?
I've come across this problem and when I run my code it only shows first two test cases as right. So please help me. :-) Code: houses = int(input()) d_houses = 2 prob_percent = ( d_houses / houses ) * 100 print(round(prob_percent))
11 Antworten
+ 11
First, as Dennis said read 🐍.doc & ...
import math
... math.ceil(...) ...
+ 3
I can't give a direct answer to that because it's a code coach question.
You might find what you need in here:
https://docs.python.org/3/library/math.html
+ 2
Thank you for answering my question with patience. :-)
+ 2
I Am Nothing 😞 Don't share code in any question if there is no relationship with Question and also don't say that it's your code. It's a copy code but good thing is that you didn't remove name from code.
+ 2
Shiva Prakash As you are beginner So you need to clear your basic first otherwise you can't understand anything. Do lots of practice on different types of problems to build up your logic.
And good luck for contest.👍👍👍
+ 1
For example lets have the number 5.3
round would truncate it to 5.
According to the wording, you have to round up, so 6 would be the accepted answer, not 5.
+ 1
How can I do that? (I'm new to programming, so, please don't mind)
+ 1
🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! Thanks for your kind suggestion😊
+ 1
Janusz Bujak 🇵🇱 thank you for your answer, but I already got it😅
0
"A percentage value rounded UP to the nearest whole number."
0
Dennis I didn't understand, can you please explain in detail?