47
Bla Bla Bla bla
Last seen 5 hours ago
Member for 8 years, 1 month, 6 days
Difficulty Normal
I don't count the chickens before they hatch but I do divide the skin while it’s still on the bear despite the fact it makes no sens. Or maybe it does...
How about to remove if statement?
def fight(unit_1, unit_2):
while unit_1.is_alive and unit_2.is_alive:
unit_2.health -= unit_1.attack
unit_1.health -= unit_2.attack*unit_2.is_alive
return unit_1.is_alive
More
A lot of characters [wasted](https://py.checkio.org/mission/multiply-intro/publications/przemyslaw.daniel/python-3/1-liner-shortest/) ;-)
More
This is sad. Even the best solution doesn't answer the question 'How to find friends?'. I'll ask someone else then :-)
More
This one is ok and deserves to be in clear category. It could be made a little bit shorter by using issubclass(bool, int) -> True
More
This is beautiful algorithm. When iterating we have to check if father with his ancestors has nothing in common with son and son's ancestors. Family head must be one. This code can be just a bit [simplified](https://py.checkio.org/mission/wrong-family/publications/przemyslaw.daniel/python-3/7-liner
More
Let's make some cleaning for this code by assigning to c = roman.count
def reverse_roman(roman):
c = roman.count
result = 1000*(c("M")-c("CM"))
result += 900*c("CM")
result += 500*(c("D")-c("CD"))
result += 400*c("CD")
result += 100*(c("C")-c("CM
More
Priority queue is available on checkio, it's called heapq. What you use here is a thread safe version which is not necessary. In case of an own implementation of priority queue, I can see two drawbacks. The very first one is sorting which takes place when an element is put, and the second one is whe
More
Hell has frozen over. I can see 'Your solution failed...'. Do you know what happens with all task points in that case?
More
Actually you can remove binary function and use straight forward formatting like for example "time_binary = "{:02b} {:04b} : {:03b} {:04b} : {:03b} {:04b}".format(*map(int, time_str))"
More
This solution fails occasionally as dictionary is unordered and you end up with different output than is provided in the tests
More
Don't you think instead of interating over all days would be better to iterate over 12 months and checking every 13th?
More
Actually you don't have to use math module. Every occurance of 'math.floor(number/10)' you can replace with 'number // 10' which is ineteger division. Also you can replace '{2, 3, 4, 5, 6, 7, 8, 9}' with 'range(2, 10)'. 'if number%100 > 0:' doesnt need '> 0'
More
Nice. It can be easily simplified to:
def checkio(words_set):
return any(word.endswith(tuple(x for x in words_set
if x != word)) for word in words_set)
More
I like this solution. It needs only a little bit of cleaning. For example:
def identify_block(numbers):
a, b, c, d = sorted(numbers)
k = (b-a, c-b, d-c)
if k in {(1, 1, 1), (4, 4, 4)}: return 'I'
if k in {(1, 3, 1)}:
More
Unfortunately this algorithm has exponential complexity. Good know approach is nicely described under https://en.wikipedia.org/wiki/Euclidean_algorithm. Let's imagine we don’t know it and we want to apply your way of thinking to solve this issue. Instead of trying to find all possible prime factors
More
There is one step redundant. [Have a look](https://py.checkio.org/mission/right-to-left/publications/przemyslaw.daniel/python-3/1-liner/)
More
Nice. I would just use ternary operator [Click](https://py.checkio.org/mission/most-numbers/publications/przemyslaw.daniel/python-3/1-liner/)
More