12
Grigoriy Tretyakov
http://tinycode.ru/
Last seen 4 years ago
Member for 11 years, 5 months, 19 days
Difficulty Normal
Python web developer.
Why you make a copy of original sequence and also sort it? It make your code work longer than it can be.
BTW in python you can swap elements in list like this:
arr[i], arr[i + 1] = arr[i + 1], arr[i]
with no temp variable.
More
You don't need to convert set to list every time, instead you can simply iterate through set.
More
Hi, maybe using string.digits, string.ascii_lowercase solution would be better and simplier?
More
OMG, I cannot imagine anybody could solve it by regexp.
> Some people, when confronted with a problem, think
> “I know, I'll use regular expressions.” Now they have two problems.
More
It's a 3 lines actually, you just don't type enter after ':'. If you truly need a one or two line, you can do this:
checkio = lambda *args: float(max(args)) - float(min(args)) if len(args) > 1 else 0
or
def checkio(*args):
return float(max(args)) - float(min(args)) if len(args) >
More
[Stop writing classes](http://www.youtube.com/watch?v=o9pEzgHorH0)
Do you really need a class here?
More