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.
This was awesome, nicely designed and really makes you think.
Wow, impressive design. This really instills a great foundational understanding of control flow, validating inputs in a logical and correct way, and edge case testing.
Why tthis exercise dont complie in typescript?
An author?
Thank you friend, your advice help me alot and save me lot of time on last part of training.
Thank you for this kata, but frankly speaking it is not an 8kyu
Take
a = "a", b = "b"
as an exampleThe conditional statement will compare it like this (
"A" === "a" || "b" === "B"
). Clearly, both of them are not equal, so any alphabetical letters (a-z
andA-Z
) will not enter this part of the control flow statement. Whilst, if you compare any non-alphabetical letters, (~
/!
/?
), changing of casing does not affect them, so the condition will be as such:which will always evaluate to
true
, hence returning-1
Your conditional logic is wrong. Your code seems like pseudocode, though a human can understand it, a computer or interpreter cannot. So, let's break it down:
if a or b is not same_case:
First condition is
a
(will evaluate toTrue
, unless it is an empty string""
)Second condition is
b is not same_case
(same_case
is a function, and will always evaluate toTrue
sinceb
will never be a function object)So, your code will always output
0
regardless of inputs since theor
operator is used in which either one condition beingTrue
will direct the control flow to that part of the statement (return 0
)The same logic applies to
elif a or b is not letter:
(letter
variable is not defined whatsoever though)Approved
Approved
CoffeeScript translation
Scala translation
This comment was very helpful!
This comment is hidden because it contains spoiler information about the solution
return -1
Loading more items...