occurrence of each character in a word

Sai_kiran_rachakonda · October 30, 2022
x = 'programm'
d = {}
for i in x:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
        
print(d)
Output

Comments

Please sign up or log in to contribute to the discussion.