9
Last seen 6 years ago
Member for 9 years, 11 months, 11 days
Difficulty Normal
I really like this. I am guessing count returns a dictionary as count.values is used on the next line. I think it could great educational value if there were a few more comments.
More
I like the way you do your comments very neat. I will start doing the same.
More
I like how you added text.lower() after the if. I had a separate line before the for loop with text= text.lower()
More
Hi I noted the following PEP8 advice in a comment the other day:
For sequences, (strings, lists, tuples), use the fact that empty sequences are false.
Yes: if not seq:
if seq:
No: if len(seq)
if not len(seq)
Play with the idea and see what you think.
More
Hi Hanpari many thanks for the review! I see your point on lines two and three. When I was reviewing other solutions after I posted, I noted that sorted() would take a tuple and return a list. Oh well, hopefully I remember it for next time.
More
Hi thanks for again for the review. Yeah, I noted that point after I had read other's solutions. I did feel good about finally writing a lambda expression - even though it was necessary;-)
More
Interesting. What is the reason you chose to use a object oriented programing? It is very readable.
More
Hi,
Re line 8 and 10 and len(stack) > 0, check out PEP 8 on empty sequences:
For sequences, (strings, lists, tuples), use the fact that empty sequences are false.
Yes: if not seq:
if seq:
No: if len(seq)
if not len(seq)
I saw someone else mention it the other day. I have been playing
More
Your solution forced me to go back and look at toordinal and proleptic Gregorian ordinals. Interesting method of attack.
More
.resolution ... interesting. How does that work? I read the docs and googled it without much luck.
Also seems like a while loop would have worked if you are incrementing each day in line 14. How does that increment work with the for loop?
More
I like how you caught the value error and return the list of 0s. I am novice and I am still trying to comprehend why try and except is ever used (i.e. why don't you just correct the expected error with additional code beforehand), but this provides a great example.
More