Python Forum

Full Version: Python Finding Prime Factors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
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().