Answer:
from random import randint
winner  = False
number = str(randint(10000, 99999))
while (not winner):
    correct = 0
    total = 0
    guess = input()
    
    if(number==guess):
        winner = True
    else:
        for i in range(5):
            if(number[i] == guess[i]):
                correct+=1
                total+=int(number[i])
        
        print('Correct: '+ str(correct))
        print('Total: '+ str(total))
print('Winner')
Explanation:
I´m gonna show a solution in python 3
Step 1 import library for generate random number
from random import randint
Step 2 create necesary variables to get the number and if the player is winner or not
winner  = False
number = str(randint(10000, 99999))
Step 3 loop while the player is not the winner
while (not winner):
Step 4 get the player guess number
guess = input()
Step 5 validate if the player win
 if(number==guess):
        winner = True
Step 6 if the player is not winner review what numbers are  in the correct position
for i in range(5):
            if(number[i] == guess[i]):
                correct+=1
                total+=int(number[i])
Step 7 print the hint
print('Correct: '+ str(correct))
print('Total: '+ str(total))