Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. #This function accepts a positive whole number and returns a list of all the number's factors in ascending order
  2.  
  3. def factors(number):
  4.     factor_list = []
  5.     for i in range (1, number + 1):
  6.         if number % i == 0:
  7.             factor_list.append(i)
  8.             (factor_list.sort())
  9.        
  10.     return factor_list
  11. print(factors(81))
  12. print(factors(25))
  13. print(factors(60))
  14. print(factors(1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement