9
Troy Walters
Last seen 4 years ago
Member for 10 years, 4 months, 14 days
Difficulty Normal
Nice work, but you can also do this in one line without importing the re library.
More
Good job. You can clean this up a bit.
for word in words:
if text.lower().find(word) != -1:
words_found += 1
can be written more succinctly as:
for word in words:
if word in text.lower():
words_found += 1
More
Although your code works, it could be A LOT simpler. I would check out some of the other answers for some ideas as to how you can accomplish this more elegantly.
More
Nice work with the one-liner, but you can get rid of that ugly alphabet string using the .isupper() method.
find_message=lambda t:''.join(l for l in t if l.isupper())
More
Nice. You can simplify this a bit. You don't need to make str(number) a list. A string is already an iterable.
More
Too confusing. You can implement this in a much cleaner and shorter way without a while loop.
Also:
range(0,len(seq)-1) == range(len(seq)-1)
True
You dont need the 0
More
Cool. Very similar to mine. Good idea to use endswith(), I forgot about that one.
More
nice, but I don't think a Class is appropriate for this problem. What purpose would an instance of BooleanAlgebra class serve in OOP?
More
This works, but its super complicated. You can do this without any looping or branching.
More
Check out Python list comprehensions to do away with that nested for, if loop.
More
Well done with relatively few lines of code. Line 5 is is very long and I can't see all of it. Might want to break that up into several lines for readability.
More