Skip to content

Instantly share code, notes, and snippets.

View dorianturba's full-sized avatar
🐍
Coding Python

Dorian Turba dorianturba

🐍
Coding Python
View GitHub Profile
@dorianturba
dorianturba / count_living_per_year_perf.py
Last active April 20, 2023 17:47
Count how many people are alive per year, based on their birthyear and deathyear, aims for performances.
import collections
import random
import timeit
pop = [
(b := random.randint(1900, 2000), random.randint(b + 1, b + 100))
for _ in range(10000)
]