# https://packaging.python.org/en/latest/tutorials/installing-packages/
$ python3 -m pip --version
$ python3 -m ensurepip --default-pip
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
def positives(n): | |
yield n | |
yield from positives(n+1) | |
def primes(s): | |
n = next(s) | |
yield n | |
yield from primes(i for i in s if i%n != 0) | |
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
from timeit import repeat | |
from statistics import mean | |
def stats(stmt, r=100): | |
res = repeat(stmt, globals=globals(), repeat=r) | |
print(f'Avg: {mean(res)}\nMin: {min(res)}\nMax: {max(res)}') | |
""" | |
def foo(): | |
return 1+1 |
1 | 2 | 3 |
---|---|---|
4 | 5 | 6 |
1 | 2 | 3 | 4 |
---|---|---|---|
5 | 6 | 7 | 8 |
9 | 10 | 11 |
NewerOlder