int object is not iterableの原因と発生機序が分かりません
sen = str(input())
sen_lower = sen.lower()
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
alpha_num = [[0] for l in range(len(alpha))]
print(alpha_num)
for i in range(len(alpha)):
for k in range(len(sen_lower)):
if sen_lower[k] == alpha[i]:
alpha_num[i] += 1
print(alpha_num)
listprint
TypeError Traceback (most recent call last)
<ipython-input-14-7e22160a987a> in <module>()
7 for k in range(len(sen_lower)):
8 if sen_lower[k] == alpha[i]:
----> 9 alpha_num[i] += 1
10 print(alpha_num)
11
TypeError: 'int' object is not iterable
`alpha_num``print`
9
`alpha_num`
alpha_num = [0 for l in range(len(alpha))]