10
Last seen 1 year ago
Member for 7 years, 5 months
Difficulty Normal
Thanks for the highlight of divmod. There are so many built-in functions I never paid attention to and end up recreating all the time. :)
More
FYI string.ascii_uppercase gives you all of the uppercase letters. Also the .isupper() function on a string or character (single length string) will tell you if the string is uppercase or not. :)
Line 8 could read: if text[i].isupper() or if text[i] in string.ascii_uppercase
Also, strings are it
More
I considered using list comprehensions in my solution, but wasn't sure how it would read. Nice solution.
More
Tip: Since your if_pali() method simply checks for data == data[::-1], you can replace the call to the method with that simple check. E.g. replace if if_pali(text[i:i+j]): with if text[i:i+j] == text[i:i+j][::-1]:
More
Nice job. I tried to break your solution, but it's legit and much faster than mine.
More
FYI: str.upper() will convert the characters to all upper case, allowing you to only define upper case chars in your VOWELS and CONSONANTS variables.
I didn't realize punctuation was in the string module. That's useful.
More
This is the solution I came up with and here I was feeling lazy and dumb for something so trivial. :p
More