+ 1
How can I resolve error from my code 'prime' .
4 Respostas
+ 2
Thanks,but in my code what should I do to remove error ( in both condition including comment code)
+ 2
Thanks
+ 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))
+ 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