Hi i'm new in programming and in python and i have an assignment that i cant 
complete. I have to Write a Python program to compute and print the first 200 
prime numbers. The output must be formatted with a title and the prime numbers 
must be printed in 5 properly aligned columns . I have used this code so far :

numprimes = raw_input('Prime Numbers  ')
count = 0
potentialprime = 2

def primetest(potentialprime):
    divisor = 2
    while divisor <= potentialprime:
        if potentialprime == 2:
            return True
        elif potentialprime % divisor == 0:
            return False
            break
        while potentialprime % divisor != 0:
            if potentialprime - divisor > 1:
                divisor += 1
            else:
                return True

while count < int(numprimes):
    if primetest(potentialprime) == True:
        print potentialprime
        count += 1
        potentialprime += 1
    else:
        potentialprime += 1

but i get the result in a single column . How can i get it in 5 rows? Can 
someone help please
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to