The average that lied — Data Analyst · Pretender
A fictional school survey asked students to rate lunch from 1 to 5. Some left the answer blank (stored as null). The current code says the average is 2.1 — suspiciously low. Fix it. Make the average count only real answers.
Code checks · ~4 min
Your role
You're the data analyst (in this game).
Your goal
Make the average count only real answers.
What you know
- Blank answers are not zeros: nobody gave lunch a 0.
Limits
- If nobody answered, return null instead of crashing.
Success looks like
- Clean data — Blanks were removed.
- Edge case — No answers doesn't crash.
- Right divisor — You divided by the real answers.
Skills you used
- Logical thinking — Following steps and rules precisely.
- Debugging — Finding what's wrong and why.
In real life
Handling missing values is one of a data analyst's most common tasks: treating blanks as zeros is a classic mistake that can change conclusions.
Data Analyst
Turn numbers into honest answers.
Explore next
- Software Developer — Build the apps and tools people use every day.
- Journalist & Fact-checker — Find the facts, check them and tell the story fairly.
- Lab Scientist — Ask questions and test them with fair experiments.
Keep exploring
Other languages
Loading MyLeoNes™…