Below is the python program to list all the prime numbers in 1 to 100.

——————————————————————

prime_list = []

for i in range(1,101,2):

prime = True

#if i%2 != 0:

for j in range(2,int(i/2)):

if i%j == 0:

prime = False

if prime :

prime_list.append(i)

print (“%s”%prime_list)

——————————————————————

### Like this:

Like Loading...

*Related*

Tags: prime number, Python program, python program to find out the prime numbers within a range

This entry was posted on December 15, 2013 at 9:16 PM and is filed under Python. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

## Leave a Reply