Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def divisore(tot,list_divisori):
- print('valore totale immesso:',tot)
- list_num_primi=[2, 3, 5, 7, 11, 13, 17, 19]
- if tot!=1:
- for x in list_num_primi:
- if tot%x == 0:
- tot =int(tot/x)
- #print('nuovo tot',tot)
- list_divisori.append(x)
- divisore(tot, list_divisori)
- break
- else:
- list_divisori.append(1)
- return (list_divisori)
- def main():
- for i in range(2,21):
- lista_divisori=[]
- lista_divisori.append(divisore(i,lista_divisori))
- print('lista divisori', lista_divisori)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement