Last active
March 24, 2016 13:24
-
-
Save lovasoa/9e14b9b2bd985af25f7d to your computer and use it in GitHub Desktop.
Énigme pour Alexis. Que fait ce script ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sqlite3 | |
| conn = sqlite3.connect(":memory:"); | |
| cur = conn.cursor() | |
| cur.execute("CREATE TABLE IF NOT EXISTS nums(n INTEGER PRIMARY KEY)"); | |
| cur.executemany("INSERT INTO nums VALUES (?)", ((i,) for i in range(1,1000))); | |
| cur.execute("DELETE FROM nums WHERE (SELECT COUNT(n2.n)>2 FROM nums AS n2 WHERE nums.n%n2.n=0)"); | |
| for (n,) in cur.execute("SELECT * FROM nums"): print(n, end=' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment