15
Imelda
2 13 22
928/ 1195
Last seen 5 years ago
Member for 9 years, 3 months, 23 days
Difficulty Normal
Best reviews / Newest reviews
regexp-lv_shadowoflv 2
The quantifiers (plus signs) in your regex are superfluous. There is no need to match more than one character of each of the character classes. More
First-KRThunder 1
if foo == bar: return True else: return False can be written more concisely as: return foo == bar More
Monkey Typing Monkey searching-schanjr
I expect there to be performance penalties at least for: * lowercasing words that are already lower case (by precondition) * compiling and evaluating regular expressions for simple substring matches * branching to an empty else statement In summary, this solution does not look particularly speed-o More
Second-Tatapouftatapute
The text is lowercased for each word in the words set. It should be faster to do this only once. More
First-saklar13
This is a bit scary in that the loop might never terminate or the fibo list might have a typo. Mission accomplished. More
First-Kousuke
You might want to remove the debug output and the boilerplate comment (replace this...). More
__-Cjkjvfnby 1
Creative use of the fact that True and False evaluate to 1 and 0 in a sum. More
First-cizeko
A set of words is iterable. There is no need to transform it to a list first. Neither do we need to use an index i since we don't care about it in the loop. Your solution can thus be simplified like this: def count_words(text, words): N = 0 text = text.lower() for More