Как убрать ошибку RuntimeError: dictionary changed size during iteration?
def top3(st):
st = st.lower()
sp = {}
for i1 in 'qwertyuiopasdfghjklzxcvbnm':
if st.find(i1) != -1:
sp[i1] = st.count(i1)
a = 3
while a > 0:
for i2 in sp:
m = max(sp.values())
if sp[i2] == m:
print(str(i2) + ' - ' + str(sp[i2]))
sp.pop(i2)
print(sp)
a -= 1