29
Michal Plichta
Last seen 5 months ago
Member for 7 years, 5 days
Class Nokia
Open-minded engineer with international experience in troubleshooting and analytical problem solving. Result-oriented tester with a high ability for prioritizing tasks. Personally – friendly, humorous and creative person, with positive impact.
never ever iterate list like that! it is not pytonic code! Do you like:
def checkio(entry):
filtered_list = []
for i in entry:
if entry.count(i) > 1:
filtered_list.append(i)
return filtered_list
More
you can use `reduce` and then simply:
def greatest_common_divisor(*args):
return reduce(gcd, args)
More
last if can be squeeze to:
return all([length >= 10, cont_num, cont_small_case, cont_upp_case])
function `all` (see [docs](https://docs.python.org/3/library/functions.html#all)) take any iterable (list, dict etc) and return `True` if all elements validated to `True`, and return `False` if at
More
nice, I had the similar idea [strptime and strftime](https://py.checkio.org/mission/time-converter-12h-to-24h/publications/mplichta/python-3/strptime-and-strftime/)
More
use max instead of sorted ;) [max lambda](https://py.checkio.org/mission/best-stock/publications/mplichta/python-3/max-lambda/?ordering=most_voted&filtering=group)
More
gcd is already in python std lib see: [my solution](https://py.checkio.org/mission/gcd/publications/mplichta/python-3/recuded-gcd/)
More
you can use [cycle](https://py.checkio.org/mission/multicolored-lamp/publications/mplichta/python-3/use-cycle/) to get job done
More
better use [strptime and strftime](https://py.checkio.org/mission/time-converter-12h-to-24h/publications/mplichta/python-3/strptime-and-strftime/)
More
last element of return tuple can be just:
elements[-2]
use python slicing ;) take 2nd from end...
More
I had the same idea [strptime and strftime](https://py.checkio.org/mission/time-converter-12h-to-24h/publications/mplichta/python-3/strptime-and-strftime/)
More
looks over complicated to me [check this out](https://py.checkio.org/mission/multicolored-lamp/publications/mplichta/python-3/use-cycle/)
More
why just use `max` with `key`? [max lambda](https://py.checkio.org/mission/best-stock/publications/mplichta/python-3/max-lambda/?ordering=most_voted&filtering=group)
More
not bad! I have similar approach: [max lambda](https://py.checkio.org/mission/best-stock/publications/mplichta/python-3/max-lambda/?ordering=most_voted&filtering=group)
More
use `key` parameter in `max` function: [max lambda](https://py.checkio.org/mission/best-stock/publications/mplichta/python-3/max-lambda/?ordering=most_voted&filtering=group)
More
I saw two way to improve it.
1. you can, unpacking tuple, pass *date1 do **D1** and *data2 to **D2**
2. there is **.days** property on date object to make return statement clearer
You can check out my [solution](https://py.checkio.org/mission/days-diff/publications/mplichta/python-3/second/)
More
use `key` parameter: [max lambda](https://py.checkio.org/mission/best-stock/publications/mplichta/python-3/max-lambda/?ordering=most_voted&filtering=group)
More
make code more pythonic: [max lambda](https://py.checkio.org/mission/best-stock/publications/mplichta/python-3/max-lambda/?ordering=most_voted&filtering=group)
More