I am trying to write a function that will take in a string and use a dictionary to calculate and return the most common letter in that string. I believe that my code is close to working; however, I get a "cant assign to function call" error on line 5.
Here is my code so far:
def mostCommon(myString):
charCount = []
for c in myString.lower():
if c in charCount:
charCount(c) += 1
else:
charCount(c) = 1
myVal = 0
myKey = 0
for key, value in charCount.lower():
if value > myVal:
myVal = value
myKey = key
return charCount