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]
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]
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。