22
Last seen seconds 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.
Thank you for showing me `setdefault`: As fas as I remember I have not used it before. I like this solution. But I'm unsure if two loops were needed. Maybe one loop combined with del will be faster.
More
Good solution. ... and I have counted spaces. ;-) Maybe I should search for a fitting library next time, first.
More
I've never used map before. After doing some reseach, I understand how this is working. So basically this "converts the string into a array of integers and get the biggest of it". Good Job. :-)
More
Well, that's a nice and clean solution. Thank you for showing it to us. :-)
More
Cool way to solve this with bool as index value. I really have learned something. Thank you!
But the mission seem to have changed a bit. When checking out your solution I got:
Traceback (most recent call last):
File "12-sum-by-type.py", line 42, in
assert sum_by_types([]
More
Thank you! That teached me a bit more about "lambda". So you just have to replace the complete:
def nearest_square(number):
...
with just:
nearest_square = lambda x: round(x**0.5)**2
which replaces the original function. Nice. :-)
More
Interesting way to solve this with many "<" and ">". :-) I've learned something. Thank you.
More
I tried something similar at first. However, cases like
'12 34 567'
(multiple space between numbers) are not taken into account. So it's easier just to compare the text against it's uppered text.
return text == text.upper()
More
Nice. It's similar to my solution, but I have not seen "//" before and have used int() for that. I have learned something. :-) Thank you.
More
Interesting solution that I probably wouldn't have thought of. Thanks for sharing.
More
Well, it seems to work. But if you would have used set() and intersection this would have been much easier. Also no loops would have been needed.
Hint from description:
> Here you can learn how to work with strings and **sets**.
More