Topics / 🐍 Python Foundations / 🕵️ Level 6: Finding Odd Data: Filters, Sets, Z-Scores

Python exercise · about 5 minutes · free

Filter a Dictionary: Catch the Aimbot

Nobody has 99% accuracy. The data knows.

Anomaly detection starts simply: pick a threshold, flag whatever crosses it.

[k for k, v in d.items() if v > 0.9]

Worked example (different data from your task)

temps = {"Pune": 31, "Leh": 4, "Delhi": 39}
hot = [city for city, t in temps.items() if t > 35]
print(hot)  # ['Delhi']

Common mistake: > and >= differ: "above 0.95" means >. Loop over .items() to get both the name and the value.

Bar chart: Kai 0.41, Mia 0.38, Bot9 0.99, Zed 0.97, Ali 0.5. anything above the line is flagged0.41Kai0.38Mia0.99Bot90.97Zed0.5Ali0.95 thresholdanything above the line is flagged
Your quest: Set suspects to every player whose accuracy is above 0.95.
Try it now Runs in your browser. No sign-in needed. Ctrl+Enter to run.
Hint[name for name, acc in accuracy.items() if acc > 0.95]
Output appears here.

Open it in the full course → Free with Google: saves your progress and unlocks 627 lessons.

In this level you'll learn:
More in Level 6: Finding Odd Data: Filters, Sets, Z-Scores

Share on LinkedIn