Python Online Compiler & Playground
HTML/CSS/JavaScript
HTML
CSS
Javascript
C++
C
PHP
Java
Python
Swift
C#
Ruby
Node.JS
Kotlin
jQuery
Go
R
TypeScript
Start Python Course
Register
Check primes with one line of code
+64
Author: Tob
Dark
Public
Save
PY
py
1
2
3
4
p=lambda n:(n>1)&all(n%i for i in range(2,n))
#I'll add a second line to show this actually work
s ;)
print([x for x in range(100) if p(x)])
Enter to Rename, Shift+Enter to Preview
OUTPUT