Python Forum
Python Finding Prime Factors - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: Homework (https://python-forum.io/Forum-Homework)
+--- Thread: Python Finding Prime Factors (/Thread-Python-Finding-Prime-Factors)



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().