高分悬赏问题,从键盘输入一个数组,使用选择排序,对数按照最大质因数正向排序,具体代码怎么写

高分悬赏问题,从键盘输入一个数组,使用选择排序,对数按照最大质因数正向排序,具体代码怎么写

# 首先输入长度
Lenth = int(input())
List = []
List2 = []
List3 = []
for i in range(Lenth):
    List.append(int(input()))
    List2.append(List[i])
    j = 2
    while True:
        if List[i] % j == 0:
            List[i] /= j
        else:
            j += 1
        if List[i] == 1:
            List[i] = j
            break
for i in range(Lenth):
    List3.append(List2[List.index(max(List))])
    List2.pop(List.index(max(List)))
    List.pop(List.index(max(List)))
print(List3)