Implement a function named getprimes(end). This function will return a list of prime numbers that is less than or equal to the end number passed in as a parameter. Try to make your function be efficient.

Solution submitted by Dzeng at March 7, 2020, 11:02 p.m.
Solution submitted by Andrew at May 26, 2020, 12:42 a.m.

```
num = int(input("Enter the number you would like the list to go up to."))
data_list = [i for i in range(2, num +1)]
primes = []
while len(data_list) > 0:
primes.append(data_list[0])
for l in data_list:
if l % primes[len(primes)-1] == 0:
data_list.remove(l)
print(primes)
```

```
def isprime(input):
for i in range(2, input):
if input % i == 0:
return(False)
return(True)
def getprimes(number):
for i in range(1, number):
if isprime(i):
print(i)
getprimes(1000000)
```

You need login to submit your solution

Doubles

Shift Code

Sum Of Consecutive Prime Numbers

Find PI

Safest Positions

Largest Number Obtained

Integer Solutions Of Equation

Split a String in Balanced Strings

Jewels and Stones

Sort List By Parity

Mose Code Words

Steps To Zero

Prime Number List

First Nonconsective Number

Progress Bar

You need login to comment