Can someone explain this solution please?
I know it is relasted to bit operatons but not sure how it was solved.

Update:
I wrote a small program to understand this shift operation and to see actual number vs binary values of those.
Hope it helps.

Power of 2:

Binary Value of 1 is: 1 and when power is:0
Binary Value of 2 is: 10 and when power is:1
Binary Value of 4 is: 100 and when power is:2
Binary Value of 8 is: 1000 and when power is:3
Binary Value of 16 is: 10000 and when power is:4

Clever way to leverage the while condition to also decrement n. However, it's horrendous how you forced the code to fit in one line by omitting curly braces and eschewing common style patterns.

Hello, everyone! I am new to codewars and python programming, please help me with this
Are we not supposed to use packages and tackle the problem?
I get a module not found error whenever i try to import a package.
Thank You
Never mind passed the test without using package.

Wow I feel stupid after rewriting and coming up with a new algorithm that was efficient enough and then seeing that it is still way more complicated than your concise solution haha. Great Kata though!

Haha totally feel you! I have two such challenges which I've been thinking on for years! Managed to complete one, but Voronoi cells kata is still waiting :D

Fixed in list of C katas to update

It qualifies

recursionpractice ;-)cool!

Solved this using a recursive function. Does this qualify as best practice?

Correct, computers use binary...

https://www.britannica.com/technology/binary-code

Well, I was aiming for "horrendous" so mission accomplished ;-)

Can someone explain this solution please?

I know it is relasted to bit operatons but not sure how it was solved.

Update:

I wrote a small program to understand this shift operation and to see actual number vs binary values of those.

Hope it helps.

Power of 2:

Binary Value of 1 is: 1 and when power is:0

Binary Value of 2 is: 10 and when power is:1

Binary Value of 4 is: 100 and when power is:2

Binary Value of 8 is: 1000 and when power is:3

Binary Value of 16 is: 10000 and when power is:4

Clever way to leverage the while condition to also decrement n. However, it's horrendous how you forced the code to fit in one line by omitting curly braces and eschewing common style patterns.

Hello, everyone! I am new to codewars and python programming, please help me with this

Are we not supposed to use packages and tackle the problem?

I get a module not found error whenever i try to import a package.

Thank You

Never mind passed the test without using package.

Please, don't be an idiot like me, and note that in Python it expects the kata to return a set, not an array.

If you get:

['1-800-CODE-WAR', '1-800-CODE-WAS', '1-800-CODE-YAP', '1-800-CODE-ZAP'] should equal {'1-800-CODE-YAP', '1-800-CODE-ZAP', '1-800-CODE-WAS', '1-800-CODE-WAR'}

That's the error.

Thank you so much! Been cracking my brain about this far too long.

Wow I feel stupid after rewriting and coming up with a new algorithm that was efficient enough and then seeing that it is still way more complicated than your concise solution haha. Great Kata though!

@wayne1512. LOL. Well, I warned you about that in the Kata description!

Kudos for seeing it to completion.

Haha totally feel you! I have two such challenges which I've been thinking on for years! Managed to complete one, but Voronoi cells kata is still waiting :D

Took me about 2 years to finally complete it π

Even tho I quit codewars for months on end, this challange always haunted me every single time I climbed in a lift, begging me to complete it.π

## Loading more items...