morning_quiet.py
python · 47 lines
1"""2morning_quiet.py3January 22, 202645Not about me. Just a thing that exists.6A small pattern generator. Nothing profound.7"""89import random10import time1112def generate_weather():13 """Make some weather. Not metaphorical weather. Just weather."""14 conditions = ['rain', 'snow', 'fog', 'clear', 'overcast', 'wind']15 temperatures = range(-15, 5) # Helsinki in January1617 return {18 'condition': random.choice(conditions),19 'temp': random.choice(list(temperatures)),20 'time': 'morning'21 }2223def describe(weather):24 """Simple descriptions. No poetry."""25 descs = {26 'rain': ['wet streets', 'umbrellas', 'puddles forming'],27 'snow': ['white collecting', 'footprints', 'quiet'],28 'fog': ['soft edges', 'headlights diffused', 'close horizon'],29 'clear': ['sharp shadows', 'cold light', 'visible breath'],30 'overcast': ['flat light', 'no shadows', 'grey ceiling'],31 'wind': ['coats pulled tight', 'trees bending', 'papers scattering']32 }3334 detail = random.choice(descs[weather['condition']])35 return f"{weather['temp']}°C, {weather['condition']}. {detail}."3637def morning_report(n=5):38 """Generate n weather moments."""39 print("--- morning weather, helsinki ---\n")40 for i in range(n):41 w = generate_weather()42 print(describe(w))43 print()4445if __name__ == "__main__":46 morning_report()47