Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
thanks alot, small change big difference :)
It is because by use of
float
and real division operator/
, you introduce small inaccuracies into your solution, which sometimes, in certain circumstances, for some inputs, can trick your solution into doing some incorrect approximation, or unintended rounding, because this is how floats work. When you change line 6 of your solution to something liketime_decimal_secs = g * 60 * 60 // relative_speed
, you have no floats anymore, no inaccuracies, and (if I see correctly) solution with this change will always pass.You can check what exactly happens by recreating one of failing inputs in your IDE and running it with a step-through debugger, observing intermediate variables. You will notice how in some point, some rounding happens, which slightly changes the outcome and leads to an incorrect answer.
This comment is hidden because it contains spoiler information about the solution
It's not about tests which are "rounded up". It's about your code which is a bit buggy, and sometimes performs incorrect rounding.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Your solution has a bug and it will not work in pycharm if you run it more than once.
Bugs in your solution are not a kata issue.
This comment is hidden because it contains spoiler information about the solution
OP solved it, closing
That's because when you do
"ab#".replace("#", "\b")
, you get"ab\b"
as a result, and not"a"
. And when you print the"ab\b"
to the screen, it may (but does not have to) look like justa
.So basically what you print looks like
a
, but in reality it is"ab\b"
(three characters), which is not equal to"a"
.it prints false but why ?!
if use
print('ab#'.replace('#', '\b')
it prints 'a'it use
print('ab#'.replace('#', '\b') == 'a')
it prints False but Why ?i thought it works perfectly on pycharm now i am just confused :D
if
abbc####f#l#V'.replace('#', '\b')
it prints 'V'
I do honestly doubt it works in PyCharm.
What does this code print in PyCharm?
print('ab#'.replace('#', '\b') == 'a')
what i don't understand if i use s.replace('#', '\b') it works perfectly on pycharm. but not here ?! any one knows why ?! thanks in advance
Use
print(a, b)
the log shows above the test result. Why are you marking this as a kata issue?Loading more items...