28
Alex Mahotin
Last seen 3 hours ago
Member for 6 years, 1 month, 19 days
Difficulty Normal
Engineer (3D modelling, 3D printing).
You're definitely right.
I really don't remember why I've decided to use strip().
Look at my code today and don't understand why, 6 and 7 are obviously superfluous lines.
Thanks.
More
Calculations are understandable and clear, but numbers handling (lines 21-36) is an antipattern.
Regarding coordinates definition, you could do it one line.
[x1, y1, x2, y2, x3, y3] = map(int, data)
More
It's great that you haven't used re module for such an easy task like many other have done.
Like your solution.
More
I like your solution, but I also have a few things to say:
+ IMO it's better to use more general approach for range boundaries assignment (lines 2,3).
The first thing: you could write _for x in range(4)_, because 0 is the default range left boundary.
The second thing: for this task input the s
More
Hi, thanks for the review.
I solved the equation in [my first solution](https://py.checkio.org/mission/feed-pigeons/publications/quarkov/python-3/analytical-solution/share/490864ba754fb16cc9f57a2e0d379033/), you could also look at that.
This is the second solution.
The point here was just to u
More
_return text[0].capitalize() + text[1:len(text)]_ and _return text.capitalize()_ do the same things
More
Could you share a link to any helpful material regarding this type of task please? I think that my solution is very weird and I'd like to know more about algorithms. Thank you in advance.
More
Nice to see I used the same approach as you did.
Making progress =)
More
Good use of sets, I really like it. Much better than looping through the whole data list.
Don't like the remove method though because it has [O(n) time complexity](https://wiki.python.org/moin/TimeComplexity) so in the worst case (all of the elements are unique) the time complexity of this solutio
More
I believe you've already seen solutions proposing usage of itertools.groupby therefore I skip this part.
You might reduce your code a little in a following way:
def group_equal(els):
if(els==[]):
return []
tmp, result = [els[0]], []
for i in els[1:]:
More
Although this solution looks neat and concise it's very time and memory greedy, especially in the worst-case scenario.
More
I like this solution, although it has O(n2) time complexity.
How long did it take you to elaborate it?
Why not just omit this part?
else:
# let's just forget about this pair
pass
More
This solution works improper in case of len(second) > len(first).
Check it out for _first = "foo", second = "baar"_.
Further, there is no need in two dictionaries. You may use one and put there pairs {first[i]: second[i]}. You may look at one of the implementations below:
def isometric_strin
More
A good one.
BTW is there any diffence between _text[0].upper_ and _text[0].upper_ in this case?
More
All's ok, but two moments I want to draw your attention at:
-lines 13-15; no need to redefine the _**data**_ and return it's new value; mostly it's better to keep intact a function's parameters, **_return unique_** would be enough in this situation.
-lines 6-11; list comprehensions works f
More
Your idea about searching in _data[i+1:]_ is interesting. It appears to be faster than using _data.count(v)_ method.
One thing I want to point out: look at the 4th line of your code. _(v in data[i+1:])_ is to be evaluated first and if it's True the second part _(v in res)_ will be skipped which s
More