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.
The core part of this solution is creating the translation table. I am creating a one-to-one mapping between a character and its rotated character in the line
string.maketrans(first, trance)
. So, after this A is mapped to N, B to O, etc.After this, I am just translating the
message
based on above created translation table.what does this code do exacly i dont understand it
This comment is hidden because it contains spoiler information about the solution
but IT IS NOT...
If you're interested in micro-optimizations, that's fine. But at the very least, don't propagate false truths...
This comment is hidden because it contains spoiler information about the solution
Hello,I am cool and you,too!
This comment is hidden because it contains spoiler information about the solution
could have written res += num*num to make it look nicer
Similar to mine. This appeared to be the more faster.
Thanks I learnt from this solution but it doesn't pass the wild test
I tried again it works only with Python2
This comment is hidden because it contains spoiler information about the solution
@FutureScience
https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html. Eval is dangerous when it is casted upon user input but it is fine in the rest of the code as long as the string being evaluated is safe. In this context it is bad because it is evaulating an input parameter which the user can possibly change.For example:
calc("5 1 2 + 4 * + 3 - 5 + __import__('os')._exit(0)")
would exit the program.Can you explain the exact meaning of "security issue"?
Eval is probably inadvisable because it puts a pretty bad security issue in your code.
I can verify. My solution does not produce the correct output for this proposed test case as well because 2/4 is not in its most simplified form, so it computes the lcm for 4, 5 and 7 when it really should be computing the lcm for 2, 5 and 7. Really good observation here--the question should be changed to also require the simplification of fractions, which would be a nice additional exercise.
Loading more items...