22
Hrvoje
http://blog.hrvoje.org/
Last seen 2 years ago
Member for 10 years, 1 month, 12 days
Difficulty Normal
Trying to make everything a one-liner and sometimes failing miserably. :)
I learned about the algorithm here... check it out, it's easier to understand than the strict and formal math textbooks: https://www.youtube.com/watch?v=QYrpHE8iDGg
More
Might be easier to write if a+b+c <= 2*max...? You also don't really need the else.
Niiiice work! :)
More
It might be more "*pythonic*" to import string and then use string.ascii_lowercase, but I like this solution - simple and interesting. Well done! :)
More
This is a clever way, well done!
**all** is also very handy and could come useful, for example:
return all(chr(i) in text.lower() for i in range(97, 123))
More
Cool! You could also simply return the first==second. If both sides compare equal, it will return true. :-)
More
This is very elegant, especially the odd ^=1 followed by a multiplication. Megalike! :)
More
Very cool use of string.join('()'). It does remind of a female body part, though. Naughty Veky. :)))
More
This is *freakishly* awesome and clever, I struggled with operators and generators, you just used sets ... boy, do I have a lot to learn. :-P
More
You don't need the stuff after the 1, simply count('1') will work just fine. :)
More
That's nice and clean. Good practice is not catching all exceptions, just the one you want to handle, otherwise programs fail silently while appearing to work.
In this case, try **except ValueError:**
More
You got it working, now try writing it again without the boring repetitions. :)
More
Very nice, clear and effective! :) Here are few tips:
You don't need the max(max(pyramid)), the maximum is in the last sublist, so a simple **max(pyramid[-1])** is enough.
Instead of list comprehension in the 2nd line, you could have used **map(list, pyramid)**.
*for i in range(len(something))*
More
I love the max(cells, key=your function... approach. My respect, one of the best coders I've seen on the site.
More