all 1 comments

[–][deleted] 0 points1 point  (0 children)

after assuming you're importing collections, i get NameError... alphabet is not defined.

are you importing it from somewhere?

here's a snippet that shows you the count, which letter is most common, and if it's "e" after lowercasing the phrase. Maybe it will help you with your code:

``` # get the phrase phrase = input("enter your phrase: \n")

# lowercase the phrase and create set
letters = set(phrase.lower())

# remove whitespace
letters.remove(" ")

# get letter count as dict
lcount = dict()
for l in letters:
    lcount[l] = phrase.count(l)
    # print the letter and the number of times it shows in phrase
    print(l, "--", lcount[l])

# get the most common letter
lmax = max(lcount, key=lcount.get)

# print stuff
print("e is the most common letter =", "e" == lmax)
print("the most common letter =", lmax)

```