+ 2

Can't pass test cases

[CLOSED] Thanks for everyone who answered! Hey there! Advice needed. This is my attempt to solve the Halloween Candy task. It was able to pass the first two test cases, but the rest three of them are being failed again and again. I can't figure out, why. Any ideas? https://code.sololearn.com/cRnGO2C561Zi/?ref=app UPD. Maybe my hands grow where from the legs must to, but ceil() didn't help for the unknown reason :( UPD 2. Fixed ceil() and floor() functions. Now the code (below) passes all the test cases... except the first one -_- https://code.sololearn.com/cSU24o2Q35eL/?ref=app UPD 3. Err... At least, it works. ¯\_(ツ)_/¯ Final code: https://code.sololearn.com/cT2efElb0sTl/?ref=app I still can't guess why this code decides "x" and "x+0" aren't the same thing.

23rd Aug 2020, 5:54 PM
Arina Yudaeva
Arina Yudaeva - avatar
6 Respostas
+ 4
You forget to round value use ceil function
23rd Aug 2020, 5:59 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
23rd Aug 2020, 7:10 PM
Roderick Davis
Roderick Davis - avatar
+ 2
Always read the question closely. The output must be rounded UP, floor () was causing the problems
23rd Aug 2020, 7:14 PM
Roderick Davis
Roderick Davis - avatar
+ 1
Thanks! /left for discovering the function/
23rd Aug 2020, 6:02 PM
Arina Yudaeva
Arina Yudaeva - avatar
23rd Aug 2020, 7:11 PM
Arina Yudaeva
Arina Yudaeva - avatar
+ 1
My mistake. Shall be more careful in future :)
23rd Aug 2020, 7:15 PM
Arina Yudaeva
Arina Yudaeva - avatar