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 solution is so clever and instructive at the same time. It taught so many of the python capabilities like the ones that you do in simple mathematical operations with slicing and especially the way you handle division!! I dont undertand a few things:
in !. not stack[-1] will push True or False in stack. So, if we hade to face a dot wouldn't it raise an error? same for `
How did you pass the Quine test? '>:# 0# # g# ,# 1# +# :# 5# 9# *# -# _@ Quine'. Lets see what I understand that happens step by step. Start--> :, stack[0] --> 0: stack[0,0] --> g: stack[62] --> ,: stack = [] output ='<' --> 1: stack[1] output='<' --> NOW THE PROBLEM +: stack OUT OF RANGE!
Do I miss something? Alhtough, I can imagine many ways to fix this but the one I see would have to change all the slicing thing that you do in mathematical operations. I would recommend changing + like this stack.append(stack.pop() + stack.pop())
the way that you implement moving, in the last for loop. Do we have to face the occasion where we get out of row or column limits like 'pacman'? To start from the beginnig of the row/col?
Found one! It's pretty easy really. I just haven't used Python much lately...
Oh, you're right! Python 3 lambdas don't deconstruct tuple arguments anymore. That's a bummer. I played around with the program a bit, but I didn't find a way to make the code as nice and compact as it was... :-(
Very nice solution.
Note: It needs to be tuned a little to work with the current version a Python.
I've re-read the details of the Loop-switch Sequence -- I was mistaken. It's only an AntiPattern when used to model a known series of steps, and for an interpreter the steps are (by defition) not known beforehand. My bad.
No, you're not missing anything - I'm just wondering why people are marking this as Best Practice rather than Clever - I like your solution tbh.
Well, I'm not sure to see any difference with your approach, I have to say. Putting the commands in function calls doesn't change the fact that they are all executed from the inside of a loop... Am I missing something?
I love the compact nature of this solution. But I can't understand why it's being voted as Best Practices - it's Clever, but it is a Loop Switch Antipattern.
The answer to this kata is visible in the 'sample test' window.
Fixed. See other posts.
Fixed. See posts below.
Fixed. See posts below.
Fixed. See other posts.
Fixed. See other posts.
Added constraints to input.
Loading more items...