Created
December 17, 2017 10:42
-
-
Save MonikaPdb/5f0365b60d29d0aab18ce093add92b90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number = int(input('Insert number. The program will return list of all prime numbers to the inserted number: ')) | |
print('You inserted the number %i' % number) | |
listofprimenumbers = [] | |
for i in range (0, number): | |
raisingnumber = 1 | |
listofnumbers = [] | |
for i in range (0, number): | |
if number % raisingnumber == 0: | |
listofnumbers.append(raisingnumber) | |
raisingnumber = raisingnumber + 1 | |
if len(listofnumbers) == 2: | |
listofprimenumbers.append(number) | |
number = number - 1 | |
print('The following list contains the prime numbers: ', listofprimenumbers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment