Prime Factors

Prime Number

def isprime(n):

    for divisor in range(2,n):
        if n % divisor == 0:
            return False
    return True
primetest(7)
True
primetest(10)
False

Write a python program to write prime factors of a number

def primefactors(n):

    for i in range(2,n):
        while n % i == 0:
            if isprime(i):
                print (i)
                n = n / i
primefactors(200)
2
2
2
5
5