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.
Very clever, well played
gg man
It depends... Nothing is completely the same.
Everything is relative
If there were additional conditions, there would be other requirements, other tests and another solution. If you have a "brilliant" idea, then make another kata and tests yourself.
I cannot agree it's the best practice and totally valid solution.
According to requirements we should return
1
,0
, or-1
. But1
andTrue
are not completely identical.Just imagine that an output of the function is used later in such piece of code:
str(same_case(a, b))
.str(True)
is not the same asstr(1)
.It seems either requirements should be changed or tests should be updated
But it's not completely the same..
This solution is so simple, Which makes it more clever.
( 1 == 1 ) ---------> True
( 0 == 0 ) ---------> True
(True == True) OR (False == False) -----Equal-----> 1
(True == False) OR (False == True) -----Equal-----> 0
Good work
True or False is the same as 1 or 0 respectively
But wouldn't the return function return True or false instead of 1 or 0
same here
Their solution is using a ternary operator. You can find out about the syntax here.