Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import sqrt
- def factors(num):
- count = 0
- ite = int(sqrt(num))
- i = 1
- while(i <= ite):
- if num % i == 0:
- count += 1
- i += 1
- count = 2 * count
- if ite * ite == num:
- count -= 1
- return count
- test_case = int(input("Enter a number to find no of factors: "))
- print('Factors count: ', factors(test_case))
Advertisement
Add Comment
Please, Sign In to add comment