+ 2
Help me with this code guys
This is my code for printing prime numbers for given range. (Total no of prime numbers) I could not pass some test cases and the cases are hidden . can you guys help me with debugging and solve it fulfilling all the test case I have inserted the code separately too. import math l,r=input().split() l =int(l) r=int(r) lis=[] lis=list(range(l,r+1)) for i in range(2,r+1): if i in lis: for j in range(i*2,r+1,i): if j in lis: lis.remove(j) print(len(lis)) https://code.sololearn.com/cFN10WLxja5c/?ref=app
14 Respostas
+ 2
https://code.sololearn.com/c46bCz5wXMur/?ref=app
+ 2
add a function from sympy
+ 1
the program could use some improvements but its working fine
+ 1
i would just check for wrong input with try except
+ 1
maybe it doesnt accepts usage of sympy
0
Thanks so much for your response love you guys
0
look at my code
0
just added a function from sympy which does all the job :)
0
Thank you so much
0
it worked?
0
The problem with the test case was if 0 and 1 are given as input ,we have to remove them that's all bruv.
0
And the if statement must also be removed .Thanks to john