标签:res 输入 一个 break span append == NPU color
def count_factors(): n = int(input(‘input the num:‘)) num = n res = [] while n > 1: for i in range(2, n+1): if n % i == 0: n = int(n/i) res.append(i) break print(‘{}={}‘.format(num, res))
输出:
input the num:90
90=[2, 3, 3, 5]
输入一个正整数,按照从小到大的顺序输出它的所有质因子(如180的质因子为2 2 3 3 5 )
标签:res 输入 一个 break span append == NPU color
原文地址:https://www.cnblogs.com/demo-deng/p/13204677.html