Mar-06-2020, 12:58 AM
Hi
I'm new to Python and new to this forum, but hope that someone can help with this question?
I've got some code which lists Prime numbers between 1 and 100.
However, it's not working!
Does anyone know what the error is?
I'm new to Python and new to this forum, but hope that someone can help with this question?
I've got some code which lists Prime numbers between 1 and 100.
However, it's not working!
Does anyone know what the error is?
def isprime(n):
if n <= 1:
return False
for x in range(2, n):
if n % x == 0:
return False
else:
return True
def list_primes():
for n in range(100):
if isprime(n):
print(n, end=' ', flush=True)
print ()
list_primesThanks in advance.
