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?
Thanks in advance.
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?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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_primes |