How can I resolve error from my code 'prime' . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I resolve error from my code 'prime' .

23rd May 2019, 2:39 AM
NISHA QURESHI
NISHA QURESHI - avatar
4 Answers
+ 2
Thanks,but in my code what should I do to remove error ( in both condition including comment code)
23rd May 2019, 3:46 AM
NISHA QURESHI
NISHA QURESHI - avatar
+ 2
Thanks
23rd May 2019, 3:54 AM
NISHA QURESHI
NISHA QURESHI - avatar
+ 1
The approach is the right one, the problem is your lambda function has some syntax errors. prime = lambda a: a>1 and all(a%c for c in range(2,a//2+1))
23rd May 2019, 3:38 AM
Diego
Diego - avatar
+ 1
prime = lambda a: True if a>1 and all(map(lambda c: True if a%c else False, [var for var in range(2,(a//2)+1)])) else False
23rd May 2019, 3:52 AM
Diego
Diego - avatar