Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def divisore(tot,list_divisori):
  2. print('valore totale immesso:',tot)
  3. list_num_primi=[2, 3, 5, 7, 11, 13, 17, 19]
  4. if tot!=1:
  5. for x in list_num_primi:
  6. if tot%x == 0:
  7. tot =int(tot/x)
  8. #print('nuovo tot',tot)
  9. list_divisori.append(x)
  10. divisore(tot, list_divisori)
  11. break
  12. else:
  13. list_divisori.append(1)
  14.  
  15. return (list_divisori)
  16.  
  17. def main():
  18. for i in range(2,21):
  19. lista_divisori=[]
  20. lista_divisori.append(divisore(i,lista_divisori))
  21. print('lista divisori', lista_divisori)
  22.  
  23. if __name__ == '__main__':
  24. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement