Skip to content

Instantly share code, notes, and snippets.

@jiridanek
Created March 3, 2024 09:46
Show Gist options
  • Save jiridanek/0ac261721fdaa29ba503dbcba6a9aead to your computer and use it in GitHub Desktop.
Save jiridanek/0ac261721fdaa29ba503dbcba6a9aead to your computer and use it in GitHub Desktop.
import pathlib
import random
stations = [
('Severní pól', -50.5),
('Špicberky', -30.5),
('Novosibirsk', 1.7),
('La Quiaca', 12.8),
('Formosa', 27.6),
('Buenos Aires', 24.9),
]
def main():
# smažeme výstupní soubor pokud existuje
measurements = pathlib.Path("measurements.txt")
measurements.unlink(missing_ok=True)
with measurements.open(mode="wt") as fp:
for _ in range(1_000_000_000):
station_name, station_mean = random.choice(stations)
temperature = round(random.gauss(station_mean, 15), 1)
print(f"{station_name};{temperature}", file=fp)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment