Python Forum
Python Finding Prime Factors - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Python Finding Prime Factors (/thread-15290.html)



Python Finding Prime Factors - foxman322 - Jan-11-2019

code must read number from txt.file
a=104

i = 2
while i < a:
    if a % i == 0:
        print(i)
        a /= i
    else:
        i += 1
print(a)



RE: Python Finding Prime Factors - ichabod801 - Jan-11-2019

See Larz's note about tags. I changed the tags to python tags for you. Note that icode tags are only for inline code.

If you need to read from a file, the basic method is text = open(file_name).read().