32
Last seen 11 months ago
Member for 11 years, 6 months, 16 days
Difficulty Normal
You could use "if number % 15 == 0" instead of "if number % 3 == 0 and
number % 5 == 0".
More
You could have used if calendar.weekday(year, month, 13) == calendar.FRIDAY
instead of the loop over weeks.
More
Kind of complicated. I think it would be better to catch first the
continuous interval when "I see the sun".
More
Good work. Just, I think it is not necessary to sort the factors. As long as
you try the divisors from 9 to 2 (which you do), if you construct the result
in the reverse order, i.e. result+= str(divisor)+result, you get the correct
answer.
More
Straightforward. Maybe you could create a function instead of duplicating
the code that calls f and g and handles compare result and errors.
More
I would actually regard "I'm" as two words, as it is an abbreviation of
"I am". That makes the whole regex stuff obsolete.
More
I give you one point for the effort, however I think that even in python
this should be solved by binary, not string operations. The algorithm is:
num1 XOR num2; count nonzero bits in the result of the previous operation.
More
The code is not very pythonic and the rewrite of morse_letterslist is
not clean. However, as long as it works...
More
The code is generally OK. If I have to express my opinion:
1) I would try to avoid the repeated exponentiation
2) this final format is much more readable: "{0:.{1}f}{2}{3}".format(number,
decimals, powers[order], suffix)
More
The conversion to lat/lng is too complicated, you could have used for
example regex c = re.findall("(\w+)", s) to get a list of numbers that
compose the coordinates.
More
Clever solution! You would get even faster performance by using set
instead of tuple for the corner cases.
More
There is exclusive or operator x^y, which could be used instead of (x+y)%2
More
I used almost the same approach, only with maps instead of lambdas, so
obviously good work :-)
More
I think it would be better to use ch.isupper() to test uppercase characters.
More
It is questionable if the object oriented approach makes the code more
readable in these small tasks. However, the main algorithm is IMHO a good
choice, so overall good work.
More