5
Srikant Mahapatra
Last seen 4 years ago
Member for 8 years, 3 months, 21 days
Difficulty Normal
You don't need a full `if-else` block. You could've just done:
if num != "0":
last_num *= int(num)
More
That looks good to me. However, I have a comment on style: put spaces around operators such as "=" or ">". It makes the code look neater.
More
I used the same idea. However, you could have shaved one character off your code by choosing the if conditional to be data.count(x) > 1.
More
My solution is identical to yours except for the "if" condition I used "symbol.isupper() == True"; then I realized the checking for equality is redundant because str.isupper() is itself a Boolean.
More
WOW! This is simple and elegant. Why didn't I think of this? I used a list comprehension. Haha!
More
An alternative would be to create an empty list and append to it every
uppercase letter that you encounter as you iterate over the text. Then join
the elements of the list without any spaces using the *.join()* method. I
don't know if there's any overhead involved in using the .join() method. If
More
Nice. Just one question: If you're typecasting `max` and `min` as floats inside the `while` loops, is there a need to typecast their difference in the `return` statement? If `max` and `min` are floats, their difference shall be a float too.
More
This solution should not be in the "Clear" category. It belongs to the "Creative" category instead.
More
You don't need an extra list to store the coordinates. You're unnecessarily
consuming more memory here.
More