How to insert value to specific cell in array in Python?
Question: I need to get 10 numbers from the user, and than calc the amount of times each
digit is appear in all the numbers.

I wrote the next code:

    
    
    # Reset variable
    aUserNum=[]
    aDigits=[]
    
    # Ask the user for 10 numbers
    for i in range(0,2,1):
        iNum = int(input("Please enter your number: "))
        aUserNum.append(iNum)
    
    # Reset aDigits array
    for i in range(0,10,1):
        aDigits.append(0)
    
    # Calc the count of each digit
    for i in range(0,2,1):
        iNum=aUserNum[i]
        print("a[i] ",aUserNum[i])
        while (iNum!=0):
            iLastNum=iNum%10
            temp=aDigits[iLastNum]+1
            aDigits.insert(iLastNum,temp)
            iNum=iNum//10
    
    print(aDigits)
    

from the result, I can see that the temp is not working. When I write this
temp=aDigits[iLastNum]+1, Shouldn't it say that the array in cell iLastNum
will get the value of the cell +1?

thanks, Yaniv


Answer: You can concatenate all the inputs to get a single string and use this with
`collections.Counter()`

    
    
    import collections
    ct = collections.Counter("1234567890123475431234")
    ct['3'] == 4
    ct.most_common() # gives a list of tuples, ordered by times of occurrence
    

