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.
I find it fascinating how there's always so many people who have the exact same answer as the top solution, character-for-character, and the long tail of similar equivalent solutions if you scroll down that don't have as many votes all have exactly one match. Can't possibly be because people are copying answers on this site, why would people do that and cheat themselves of a learning experience?
list() isn't actually needed, join can iterate through a string.
Don't get rid of them like this, your if statements run faster than gratuitous dicts.
Don't feel bad about your if statement, this solution with an unnecessary dict creation is slower than your if block.
If you're in a viewer and the interviewer asks you to write a program that prints the result of an addition in binary, this is the code that they want to see you write, not the python one that uses a ready made function
That's a generous way to put having the eval do the text parsing for them. This solution only works for expressions that the python language can parse and evaluate for you, and contains no concepts that can help you when the problem deviates from the python language into more complex text parsing tasks. "5 lines" is kind of a meaningless boast
It'd be nice if a correspondence dict from words to numbers was provided so we don't have to type the whole thing out ourselves
How did two different people manage to write this exact same chunk of code, down to all the variable names and spacing?
I did it slightly differently, didn't multiply back and imported Decimal to prevent python mangling precision instead
from decimal import Decimal should deal with that, Decimal guarantees true math operations without loss
for the simple ones one liners are probably actually better solutiions, and here on codewars making things into one liners is more of a sport
programming is very math though
the joke
your head
might as well go all the way and make it a one line lambda
Seperating the values from the code also makes things like translation and parameter modifying easier, good habit to get into. Don't feel bad about your solution having them, we just played golf with our code here.
Loading more items...