I would like to give some feedback about ...
From: http://www.checkio.org/mission/most-wanted-letter/solve/
HTTP\_USER\_AGENT:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
My Code:
from collections import Counter
def checkio(text):
#replace this for solution
clr = ""
for item in text:
if item.isalpha():
clr = clr+item
lowclr = Counter(clr.lower())
if lowclr.values().count(max((lowclr.values()))) == 1:
return lowclr.most_common()[0][0]
else: return sorted(lowclr.keys())[0]
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio(u"Hello World!") == "l", "Hello test"
assert checkio(u"How do you do?") == "o", "O is most wanted"
assert checkio(u"One") == "e", "All letter only once."
assert checkio(u"Oops!") == "o", "Don't forget about lower case."
assert checkio(u"AAaooo!!!!") == "a", "Only letters."
assert checkio(u"abe") == "a", "The First."
print("Start the long test")
assert checkio(u"a" * 9000 + u"b" * 1000) == "a", "Long."
print("The local tests are done.")
Created at: 2014/07/17 17:07; Updated at: 2014/07/18 17:41