Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ch(n):
- check = type(n)
- if check in [int, float, complex]:
- if check is not int or n < 1:
- raise ValueError
- else:
- raise TypeError
- # Это факторизация целых чисел
- i = 2
- primfac = []
- while i * i <= n:
- while n % i == 0:
- primfac.append(i)
- n = n / i
- i = i + 1
- if n > 1:
- primfac.append(int(n))
- return primfac
- print(ch(123))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement