Unable to enter user input as list in python

  Kiến thức lập trình

I expected that the code would ask me for input as many times as I want and then print out the number of times the input has been entered along with the name, capitalized. However, it only prints out the last input with 1 in front of the input

Can you tell where am I wrong

while True:
        lst = [
          input('Enter name here: ')
    except (KeyboardInterrupt): 
        for n in lst:
         print(lst.count(n), n.upper())

New contributor

Manansh Arora is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website