Tag Archives: Homework

AI on the Edge LESSON 4: Python Averaging Grades Homework Solution

Hey everyone, and welcome back to the AI on the Edge series!

In Lesson 3, I gave you your first real programming homework — to create a program that lets the user enter multiple grades and then calculates the average. In today’s Lesson 4, we go through the solution together step-by-step.

This lesson is all about learning how to work with lists (also called arrays), using for loops effectively, and building clean, organized code. Even though averaging grades might seem simple, these are fundamental programming skills that we will use constantly as we move forward in this class. Whether we’re averaging sensor readings, smoothing camera data, calculating confidence scores from AI models, or processing batches of information — the ability to collect data, store it, and process it is extremely important.

In the video, I walk you through a clean solution that uses a list to store all the grades, then loops through that list to calculate the total before dividing by the number of grades. You’ll also see how to display the original grades back to the user and present the final average in a nice, readable way.

I really enjoy these early lessons because this is where you start developing good programming habits. The techniques you learn here — using lists, loops, and organizing your code — will become the building blocks for much more powerful AI projects later in the series.

By the end of this lesson, you should feel much more comfortable working with lists and loops in Python. These skills are going to be used over and over again as we start reading sensors, processing camera frames, and handling data from AI models.

So if you tried the homework, awesome! If you got stuck, that’s perfectly okay — that’s exactly why we go through the solution together. Take the code, run it, and then I strongly encourage you to modify it. Try adding letter grades (A, B, C), calculate the highest and lowest grade, or make it keep running until the user wants to quit. The more you play with it, the faster you’ll learn.

You’re doing great! These early Python lessons are the foundation we need before we start combining code with real hardware and AI in the coming lessons. Keep going — we’re building something really cool here!

This is my homework solution.