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.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
My problem: Your page keeps telling me I failed when it runs the "try it" Lorem ipsum text through my code. All other checks pass just fine. The page is pulling a bunch of 0's into the text which I don't see, and it won't let me submit my code and move on (even though all other assertions are true). I can provide a screenshot if necessary.
My Code:
def checkio(text):
output = text.lower() #make it lowercase, caps dont matter
alreadycounted = []
highest = 0
counter = []
for o in output:
if o not in alreadycounted and o.isalnum() == True:
if output.count(o) > highest:
highest = output.count(o)
counter = []
counter.append(o)
elif output.count(o) == highest:
counter.append(o)
alreadycounted.append(o)
counter.sort()
#print("Your word is: " + str(text))
print("Highest letter: " + str(counter) + " with " + str(highest) + " occurrences")
if len(counter) > 0:
return counter[0]
else:
return False
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/08/25 18:44; Updated at: 2014/08/25 20:01