HOME/Articles/

simple python-example-14 (snippet)

Article Outline

Python example 'python-example-14'

python-example-14

Python example: python-example-14

#!/usr/bin/python
# -*- coding: UTF-8 -*-

from sys import stdout
n = int(raw_input("input number:\n"))
print("n = %d" % n)

for i in range(2,n + 1):
    while n != i:
        if n % i == 0:
            stdout.write(str(i))
            stdout.write("*")
            n = n / i
        else:
            break
print("%d" % n)