+ 1
what should i do with this code to recive non empty list!?
5 Respostas
+ 2
First isPrime function has one parameter. Second isPrime function return a bool: true or false.
Now you can think again about, how can the code be corrected.
+ 2
Why you write i+=1 in the for loop?
+ 1
i rewrite this code like this @JaScript but i donnow how i make the list output:
def isPrime(x):
if x < 2:
return False
elif x == 2:
return True
for n in range(2, x):
if x % n ==0:
return False
return True
a = int(input())
b = int(input())
i=[]
def primeGenerator(a, b):
#your code goes here
for i in range(a,b):
i+=1
if isPrime(i):
print(i)
primeGenerator(a,b)
+ 1
def isPrime(x):
if x < 2:
return False
elif x == 2:
return True
for n in range(2, x):
if x % n ==0:
return False
return True
a = int(input())
b = int(input())
i=[]
def primeGenerator(a, b):
#your code goes here
for i in range(a,b):
i+=1
if isPrime(i):
yield(i)
print(list(primeGenerator(a,b)))
+ 1
i write it from last commit i forgot to delete that.