I'm really confused on this one, why my function is returning None too?
def CharFreq(string):
l = list(string)
for i in range(len(l)):
count = 0
print(l[i])
for j in range(0,len(l)):
if l[i] == l[j] :
count+=1
print (l[i],count)
print(CharFreq("hih"))
First, My function is returning None too, and when I put the line of print(l[i]), it also does return None.. but when I do this alone, I don't see any None:
l = list("hih")
for i in range(len(l)):
print(l[i])
Second, I'm trying to develop a basic approach for char frequency using two loops, not only it's returning None too, but also it looks like my indices are wrong, I need it to return:
h , 2
i, 1