Chapter 23.3: Example 3 while loop

#counting a character how many times it comes in a string
name   = input("Enter your name: ")
length = len(name)
temp   = ""
i      = 0
while i < length:
  if name[i] not in temp:
    temp += name[i]
    print(f"{name[i]} : {name.count(name[i])}")
  i += 1

Output:

Enter your name: Free Learning

F : 1

r : 2

e : 3

  : 1

L : 1

a : 1

n : 2

i : 1

g : 1