Mini Survey Analyzer Project Worksheet
Computing Foundations 90-Minute Block Lab
Mini Survey Analyzer
Python Programming Challenge • Google Colab
survey_analyzer.py
Name:
Date:
Period:
Learning Goal: Use Python variables, input(), int(), arithmetic calculations, percentages, round(), and print() to build an automated yes/no survey analyzer.
1
Create Your Survey Question
Only YES / NO Responses
Question Criteria:
- Answerable strictly with YES or NO
- School appropriate & easy to understand
- No private or sensitive personal info
Sample Ideas (or create your own):
- • "Do you listen to music while doing homework?"
- • "Do you prefer sweet snacks over salty snacks?"
- • "Have you ever played Minecraft?"
My Survey Question: (Create your own question whenever possible)
Q:
2
Collect Your Data (10–15 Classmates)
Live Peer Poll
Total Surveyed (Target: 10–15)
YES Responses (Count of "YES")
NO Responses (Count of "NO")
Does YES + NO = TOTAL? Yes No (fix data first)
Accurate data matters! A program can calculate correctly and still give a bad result if input data is wrong.
3
Plan Your Program: Variables
Plan before coding
Decide your variable names and types (str, int, or float) before opening Google Colab:
| What It Stores | Variable Name | Data Type |
|---|
| Survey question text | | |
| Total responses | | |
| YES responses | | |
| NO responses | | |
| YES percentage | | |
| NO percentage | | |
Mini Survey Analyzer • Python Programming Challenge Page 1 of 3 — Survey Planning
Part 2
Program Requirements, Reference & Debugging
Google Colab Programming
4
Program Requirements Checklist
- Store the survey question in a variable
- Ask how many people were surveyed
- Ask how many people answered YES
- Store numeric responses using
int()
- Calculate NO responses: total responses − yes responses
- Calculate the YES percentage
- Calculate the NO percentage
- Use
round() to round percentages to 1 decimal place
- Use
print() statements to clearly display the results
- Run without errors in Google Colab
- Produce results that make sense
Percentage Formula
Percentage = Part ÷ Whole × 100
5
Python Tool Box
input() — asks user for info
int() — converts input to whole number
float() — converts to decimal number
print() — displays information
round(num, 1) — rounds to 1 decimal
+ - * / — math operators
Reminder: input() gives Python text unless converted into a number.
6
Expected Output Model
What your finished output should resemble:
Survey Question: Do you listen to music while doing homework?
Total Responses: 14
YES: 9 students — 64.3%
NO: 5 students — 35.7%
Could someone understand your output without seeing code?
Yes Not yet
7
Test and Debug Checklist
Verification Pass
Does the program run without errors? Are percentages rounded appropriately? Does YES + NO equal total number surveyed? Are your labels and output easy to understand? Do percentages add to approximately 100%? Did you test the program more than once?
A program that runs is not automatically a program that is correct. Check the math and the logic too.
8
Reflection
1. Why are percentages sometimes more useful than just reporting the number of people who answered YES or NO?
2. What part of your program was most difficult to build or debug?
3. If you surveyed twice as many people, would your program still work without changing the calculations? Explain.
Mini Survey Analyzer • Python Programming Challenge Page 2 of 3 — Requirements, Debug & Reflection
Part 3
Extension Challenges & Future Logic
Optional Challenges
Extension Challenges: Ready for More?
Optional for early finishers
EXT 1 Make It Reusable
Change your program so a different person could enter a completely different survey question and results without changing the calculations.
EXT 2 More Precise Results
Change your output so percentages are rounded to two decimal places instead of one. Compare the results.
EXT 3 Compare Two Groups
Survey two different groups (e.g., first half vs. second half, or freshmen vs. sophomores) and calculate YES & NO % for each.
Which group had the higher YES percentage?
EXT 4 Add an Average
Create a second question that asks classmates to rate something from 1–5. Enter several ratings into Python and calculate the average (no lists required).
Think Ahead: What Should the Computer Decide?
Concept Preview
Think about how your program could make decisions automatically without changing code (not coding these yet):
1. If the YES percentage is > 50%, what message should display?
2. If YES and NO percentages are exactly equal, what should it say?
3. If the YES percentage is < 50%, what message should appear?
4. How could the computer decide which message to display without a person manually changing code?
5. Write a human-language rule using IF / THEN:
IF THEN
6. Write another rule using IF / THEN / ELSE:
IF THEN ELSE
✨ Next week, we will learn how Python uses conditions to make decisions like these automatically.
Submission Checklist
Before submitting, verify:
Completed the survey Calculated both YES and NO percentages Recorded your data Rounded your results Built and tested your Python program Completed the reflection Submitted or shared your Colab notebook to Canvas
Colab Notebook Link / Name:
Teacher Sign-off:
Mini Survey Analyzer • Python Programming Challenge Page 3 of 3 — Extensions & Submission