Seeded simulation
Before trusting the new glitch filter, the team wants to throw simulated glitches at it: 100 readings, each with a 5% chance of going wrong. Random data is easy to make. The trouble starts when a test fails once and then passes when you run it again.
Make the simulation random, but the same random every time.
Finish stage 1 to unlock this stage.
Seed random with 42. Then, for each of 100 readings, count a glitch when random.random() < 0.05, and print the count:
Glitches in 100 readings: 7
Call random.random() exactly once per reading, after the seed: the check expects that exact count, and any other order of calls gives a different one.
Finish stage 1 to unlock this stage.
For each glitch, pick its kind with random.choice(KINDS), right after the check that found it, count the kinds in a dict called by_kind, and print them sorted after the total:
Glitches in 100 readings: 5 DROPOUT: 3 SPIKE: 2
Call random.choice() only for glitches. Look at the total: it is no longer 7.
Hints
Import System Modules
# A module is a toolbox someone else already built and tested for you
# Plain import brings in the whole module
import sys
import platform
import math
# from ... import brings in just one tool
from math import sqrt
# as gives a module a shorter nickname
import random as rng
# With a plain import: module name, a dot, then the tool
print("Python version:", platform.python_version())
print("Running on:", platform.system())
print("Python lives at:", sys.executable)
# math carries constants you would not want to type from memory
radius_km = 6371
print("Earth circumference:", round(2 * math.pi * radius_km), "km")
# sqrt arrived on its own, so it needs no dot in front
print("Square root of 9:", sqrt(9))
# rng is simply a nickname for random
print("Random sol of the Martian year:", rng.randint(1, 687))
Separate arguments with commas. They're passed on every Run as sys.argv[1:].