22
Last seen 1 hour ago
Member for 2 years, 3 months, 15 days
Difficulty Easy
I'm here to learn / improve my Python skills and help other people if possible.
I tried hard, but I don't get it. You are not using the classical board coordinates, thats for sure. I tried to understand your code using the example `4, [(2, 3), (0, 1)]`.
I'll simplify it a little here:
1. `D, E` of this example are `{1, 5} {-1}`
1. `i, j` results then in a list like `[(0, 0),
More
I didn't realize that dicts didn't have a fixed order before Python 3.6 / 3.7. Your solution gave me the opportunity to read at https://realpython.com/python-ordereddict/ what you can use OrderedDict for under current versions of Python. Interesting.
Thank you for sharing your solution.
More
I really like your solution as it's readable, easy to understand and relative short. Thanks for sharing.
More
Instructive. I had never read about takewhile before. Your code taught me something. Thanks for sharing.
More
Simple but elegant. I solved this myself back then without a real queue but only with a list. So thanks for sharing your solution.
More
This is my attempt to understand Phil15's solution. If I have misunderstood anything here, please feel free to correct me.
More
Yes, this mission is perfect for programming a recursion. Thanks for sharing your nice solution.
More
Indeed creative. I like the function itself using *args. Also the lambda is nice. I would have not thought about it. Thanks for sharing your solution.
More
Yes, that makes sense. Why define a function if there is already one in the standard system? Thanks for sharing your solution.
More
Nice combination of starmap, operator and zip_longest. I like your solution. Mine was only using zip_longest, as the rest just didn't came to my mind.
More
Even if it works to define the function `is_acceptable_password` five times, it is not conducive to readability and clarity. I dislike it.
More
Good solution. In my opinion you should switch max() and int().
return int(max(x for x in str(number)))
Then the program only need to change the max string back to integer.
In addition there is no need to have a loop when you use int() last, as max() returns the maximum value of the whole str
More
Not bad, but you can use max() on a string to get the highest char of it. Than just convert that back to int and you are done. There is no need for the loop. So a one-liner could be.:
return int(max(str(number)))
Example:
>>> int(max(str(234987)))
9
More
Thank you. Your solution has showed me how lambda and compression could be used. This is still relatively new for me.
More
Well done. I really like your solution, but personally would have used something like
splitted_text = text.split()
before the loop to avoid text.split() in every loop.
More
Well done. I like this one-liner, as it's understandable. Also I have learned about "join()". :-) Thank you.
More