I would like to give some feedback about ...
From: http://www.checkio.org/mission/most-wanted-letter/solve/
HTTP\_USER\_AGENT:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
My Code:
def checkio(text):
from collections import Counter
from re import sub
return Counter(sub('[^a-z]+', '',text.lower())).most_common()[0][0]
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio("Hello World!") == "l", "Hello test"
assert checkio("How do you do?") == "o", "O is most wanted"
assert checkio("One") == "e", "All letter only once."
assert checkio("Oops!") == "o", "Don't forget about lower case."
assert checkio("AAaooo!!!!") == "a", "Only letters."
assert checkio("abe") == "a", "The First."
print("Start the long test")
assert checkio("a" * 9000 + "b" * 1000) == "a", "Long."
print("The local tests are done.")
Created at: 2014/07/20 00:08; Updated at: 2014/07/20 10:51