n = int(input('give a natural number n : ')) d = 2; s = '%d =' % n while(d < n): (q,r) = divmod(n,d) if(r == 0): s = s + ' %d' % d n = q; d = 2 else: d = d + 1 s = s + ' %d' % n print(s)
this is just a basic prime factorization script for python that I learned in class a while ago.
Be the first to commentYou can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.