I would like to write pyton Prog to check all numbers as Prime and when not give the Prime factor back

I would like to write pyton Prog to check all numbers as Prime and when not give the Prime factor back When the user give 10 for example it should come out like this 2: prim 3: prim 4: 2,2 5: prim 6:2,3 7:prime 8: 2,2,2 9:3,3 10:2,5 I wrote the follow. Now I need for example 4: 2,2 and not only to show 2 2 how can I make this

import math
num = int(input("Enter a number: "))

for num in range (2, num + 1):
if num > 1:
for i in range (2, num):
if (num % i) == 0:
while num % 2 == 0:
print(2)
num = num / 2
for k in range(3, int(math.sqrt(num)) + 1, 2):
while num % k == 0:
print(int(i) ) num = num / i
if num > 2:
print(int(num))

            break  
    else:  
        print (num, 'Prim')