39
Axel
Last seen 2 months ago
Member for 2 years, 9 months, 17 days
Difficulty Normal
Based on my [long solution](https://py.checkio.org/mission/node-subnetworks/publications/CDG.Axel/python-3/6-lines-proc/) for New Cities
More
Great way to count zeros
Btw...
len(number.lstrip('0'))
vs
len(str(int(number)))
More
better way to sort data before, than create 3 more lists
and "len(data)//2" better than "int(len(data)/2)"
More
you can use this for shorter solution
on = List[::2]
off = List[1::2]
(O-I).total_seconds()
More
There is one small trick that helps you greatly shorten the code:
- collect all free point to a set of (x, y) tuples
- than operate one condition for all bound and color tests - (new_x, new_y) in free_points
More
1. continue is not necessary
2. you can replace "break" with "return True" and "return count >= 3" with "return False"
More
Very good! Btw small optimization:
b = {}
for j in filter(None, a.split('\n')):
More
Ideas for one-liner:
- sets
- & operation with sets
- sorted
- ','.join()
More
it's better replace dice_number == 1 --> dice_number == 0
return sum(probability(dice_number-1, sides, target+~i)
for i in range(sides)) / sides if dice_number else not target
https://py.checkio.org/mission/probably-dice/publications/CDG.Axel/python-3/one-line-recursive-with-lr
More
This solution is slightly longer (+3 lines), but clearer
https://py.checkio.org/mission/landing-site/publications/CDG.Axel/python-3/all-distances/
More
The main goal was minimum lines, with no single line longer 120 symbols
More
Great idea with filter(set.intersection,...)!
I used [e for e in network if e & friends] for this :(
Btw it helps to avoid PEP8 violation:
[graph.update(*filter(graph.intersection, edges)) for _ in edges]
More
Fastest solution for this time :) But I can't understand all the math there...
More
In this task interpretation heroes could be ennis_del_mar and jack_twist :)
More
Ideas for removing flags from code:
1. Take a letter form source string
2. Throw away two letters after if it is a vowel
3. Throw away one letter after else
More