How to implement this for multiple enteries?
Please reply
Prime Generator
Hey,
Iterate over a range 1 to n and check if ith number is a prime or not, if it is a prime print it.
This way you can generate prime number between a range of 1 to n.
def faduprimegenerator(list):
for k in range(list[0],list[0]+1):
for l in range(2,k):
if k%l==0:
break
else:
print(k,end=" ")
n=int(input())
index=1
while (index<=n) :
list=[int(j) for j in input().split()]
faduprimegenerator(list)
This works for single line entry only . Please tell how to implement this for multiple enteries
Just make a for loop for number of test case . if there are T test cases.
for i in range(T): call_prime_generate_method()
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.