actually if you had switched the positions of the 2 conditions above you would be fine, because then python would evaluate str1!='' first, and skip the str1[-1] once the first is not satisfied (ie. if str1 is empty). The error here occurred because it was trying to get the last character in an empty string
Every time i complete a high level kata, i always feel that this one for sure, there is no way a person can do it in just one line and every time i am left dumbfounded by what i see.
It was especially true for this problem but here we go again!!!
Has someone taken the case where the person might walk first N then W then S and the E into account? Meaning that he walks in a circle so baically he comes back to the point where he started after walking a circle. Ex- ['N','S','N','S','N','S','N','W','S','E'].
If so can someone share their code?
yeah he better hope nobody catches him while he stands there trying 100+ combinations on this bad security system lol
str1[-1] == ' ' and str1 != ''
actually if you had switched the positions of the 2 conditions above you would be fine, because then python would evaluate str1!='' first, and skip the str1[-1] once the first is not satisfied (ie. if str1 is empty). The error here occurred because it was trying to get the last character in an empty string
Just fire that colleague for not doing his job properly
Every time i complete a high level kata, i always feel that this one for sure, there is no way a person can do it in just one line and every time i am left dumbfounded by what i see.
It was especially true for this problem but here we go again!!!
This comment is hidden because it contains spoiler information about the solution
nope, only the contests ;)
Do you really write all your code like this?
Has someone taken the case where the person might walk first N then W then S and the E into account? Meaning that he walks in a circle so baically he comes back to the point where he started after walking a circle. Ex- ['N','S','N','S','N','S','N','W','S','E'].
If so can someone share their code?