python script to give a list of prime no.

Sathvik Babu Veligatla sathvikveligatla at gmail.com
Sun Apr 5 08:22:45 EDT 2020


hi,
I am new to python, and i am trying to output the prime numbers beginning from 3 and i cannot get the required output.
It stops after giving the output "7" and that's it.

CODE:
a = 3
l = []
while True:
    for i in range(2,a):
        if a%i == 0:
            l.append(1)
        else:
            l.append(0)

    if l.count(1) == 0:
        print(a)
        a = a + 2
    elif l.count(1) >> 0:
        a = a + 2
    


Any help is appreciated,
Thank you.


More information about the Python-list mailing list