This video demonstrates how to transform a basic Python lesson into an interactive study session tracker game, showing that programming concepts like variables, data types, conditions, functions, loops, and debugging can be made engaging through game development. The instructor walks through creating a study bot that tracks assignments, grades, and supplies, using random number generation for point calculations, conditional logic for decision-making, and while loops for continuous gameplay, while also demonstrating the debugging process when errors occur.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Another Boring Python LessonAdded:
Can you make a boring Python lesson into something not boring like a game? Well, we're going to try. For this challenge, I'm going to cut back and forth from a boring Python lesson and show how it could translate into real game development. This lesson will be split up into five sections: variables, data types, conditions, decisions, functions, loops, and lastly, debugging. Let's see how long you can make without getting bored. Today, we're going to be putting a boring Python lesson and comparing it to a fun video game creation. Starting here, we want to import random. We're going to create a study bot and it we're going to help our grades improve as students. So, importing random imports the random library, which can let us choose between the random number like rolling a die, right? We'll get to this later, but print uh let's just call it the name of our function here or our program here. So, now we have a straight-up print statement.
Let's get the user's name cuz we want to store their information. We're going to store a variable, which is just simply what we call something. So, we need to get an input from these people. So, if I were to print name, which is what we will do now, print name, which is our variable, and let's give it a little story to it, right? Name is Joey is now beginning a study session.
Now that we have the user's name, we need to ask it for some other information. So, we're going to ask it enter or just tell them to enter your age. We can go assignments left underscore left. So, assignments let's say we have five assignments left and supplies. Let's say we're going to have some abilities to do something with our supplies. So, let's do a notebook which is a string comma that separates the items in our list and a calculator. And we end it with closed brackets. And we got a syntax error and it tells us online line eight. Oh, look. I didn't put equal. Now, what is your name? My name is Joey. How old are you? So, 28.
Now, we've got all of our pieces of information.
Okay. Now, that we have all of our data and our information that we need to calculate with, now let's make some choices some decisions for for our user.
So, we're creating a study session tracker. Let's give the user two options if he wants to study or rest and those will have some repercussions later. So, we use what's called an if statement for conditions. All right. So, if something happens do this. All right. So, for instance, if choice was to rest, then it's going to do something here. All right. So, print you decide to rest.
Cool. Okay. And simply ask, do you want to rest? Let's Let's put it these around it. Rest or sleep or study. Now we have some options, right? There we go.
Question mark and quote. So now, if we run this and we ask for its name, let's go Joey, age, I'm 34 now, and do we want to rest? Let's say, yeah, let's rest.
Because we rested, it says, "You decided to rest." But what if we said, "Hey, we don't want to rest. We want to actually study or do something else, right?" So let's go else. That means all other options, right? Now let's just rest or study. So let's assume any If you're not resting, you study. We can add some different decisions in here with elif statements. Let's say print, "You begin working on or let's go working through your assignments." End quote.
choice equals input. Now, let's put some action into the study tracker. But we need to use what are known as functions.
So So let's just create three functions called one complete assignment and assignment, if I could spell it correctly. And we open and close parentheses with with functions and colon. So what this says, we imported random earlier. So let's go random.randint.
So now when we run this code, it gives us two random or a random number between 8 and 15.
>> Let's go deaf. Now you lose focus and then it returns this information or I guess maybe lose points or something. I don't know. Return random rand and random numbers between that. Let's go five, {comma} 12 is is also fine, too.
Let's create one more that we can use our notes. So, let's go use {underscore} notes. We have to store this later, but we'll get to it. Current {underscore} grade and we're going to add that to our grade, right? Which right now is a 75.
That's if we do this function, right?
So, if we use our notes. So, let's go current Let's actually go Let's create a boost. Boost {underscore} amount equals 20 is fine as an integer there. And then our current {underscore} grade, which is I think what we stored it as, yeah. Call it as plus equals as we're going to store it and add it. So, boost {underscore} amount. So, while assignments {underscore} or assignments {underscore} left is larger than zero, we're not We don't have a zero right now. We're in this information. So, we're going to call it action. This is when we're going to get input from the user. Let's give it a few options. So, other than not just if you're working, what if you decide to use your notes?
So, inside of this while loop, we can give it some options. So, now we have an action. Let's work your or do notes, right? So, let's go if action is equal to work, {colon} So, if it equals to work, points equals assignment. And then let's change our grade. So, grade is plus equals points. And then Then run a print statement. You finish and sign assignments and gain points. Let's end it with a period there. And we're not done. So now we have an if statement, but what if we have some other options?
Right now we only have coded for if it was work. So let's go elif, else if action is equal to the other option we put was notes, colon. Then we run this code. But we need to check if we're going to use our notes, we need to make sure that we have our notebook in our inventory. So we run another if statement inside of that elif statement.
So if the action is notes, then check this if statement, which is notebook in supplies. So this checks if we have our inventory or our supplies has a notebook in it. So let's go supplies remove. We can do this in a couple different ways, so let's go remove notebook. Boom, so that's done. But we're not completely done cuz now what if there isn't a notebook in the supplies? Let's go else.
Inside of our nested loop, we have to make sure that that is correctly. Print, you do Let's go Let's make it funny. You look for your notes and can't [music] find them. I can't type today. And end parenthesis. So now we're done with that logic, but else, what if we don't put work or if we don't put notes and we type something else in like "Do we eat some ramen?" Or just go to sleep or whatever. So let's go else. Or we just hesitate. Let's print, you pause and make no progress. So if Let's add one more section to this. A second secondary if statement, if you will. So if ments Once it actually hits zero, assignments_left is larger than zero, after all that we can probably just have it do a print statement instead, but whatever. Points equals lose_focus as that random number. Remember our function lose_focus takes a random integer. So essentially we're going to be losing points regardless, which is fine because we're going to hopefully be studying and using our notebook to add points, right? So, after all that, we're still in our while loop. It's going to print information for us. So, print current grade, {comma} max. So, if zero is larger than your grade, it's going to say, "Hey, you're failing. You have zero." And then All right, let's close all this up.
Let's run some math at the end that gives us bonus points for having no assignments left and having not a failing grade or a zero, I guess. And give give it a reward. So, let's go if grade, after all of this mess, is larger than zero and assignments left is equal to zero, double equal zero, right? Then, reward. Let's create a new variable equals random. And it's a random number between 1 and 30. That's fair enough.
So, let's go print that new line, "You completed all of your work." Close that out. Do another one. It's okay to put it on one print statement. That's no big deal. "You earned {comma} award {comma} points." Bonus points, let's do that.
Reward of bonus points. Close that out.
And let's do one more. Print, "Your final grade" and quotes. What are you going to do? Min instead of max. Now, let's go else. Print, next line, "The study session ends before you finish work." And after that little statement, let's just complete it. Let's go print.
Print so we're on the next line. Program complete. I didn't open my quotation mark. I haven't ran this code and we haven't tested it out and a few lines.
So, let's run it and find out. Oh, look at that. We've got issues. Line 70 says unexpected character after line continuation character and oh, yes, this needs to be inside the quotes. Let's go.
Joey, enter my age and now we've got some options. Do you want to rest or do you want to study? Of course, I want to study. I want to make my grades good.
You begin working through your assignments. Choose the action. Let's do work for now.
We've got an error on it says line 62.
Does it actually bring it to us? Yeah.
Let's see. Assignment Look, I spelled assignments wrong. Sometimes it'll actually tell you, "Did you mean this?"
So, it's a s s i g sign and I'm sure in the comments you guys are blowing it up when it actually happens. Look at that.
Now it should be good to go in line 62.
So, now let's run it. Oh, that's the wrong button. Let's run it. The name is Joey. Let's say I'm 22 now. Do I want to study? Yes, I want to study. Choose an action. Let's go work. You work. You finished an assignment and gained nine points. Nice. I now have five assignments left. I should have four assignments left. Let's see what happens if I do it again. Feel like I'm still stuck in this infinite loop now. So, let's stop it and let's go back to our function where we complete an assignment. I don't think I Oh, wait, it should be under our while loop. Complete the assignments. Probably should have subtract an assignment maybe somewhere.
So, yes, so after looking, we noticed we're stuck in this infinite loop of our assignments being left at five. That's because I forgot to add a modifier here.
So, after we decide to work and complete an assignment, assignments_left should be minus equals one. So, that means we take assignments left which should be five initially, subtract one and store the remainder. So, now let's run this again. Joey, I am 45 now. Late in college, study. Okay, so set up work through assignments. Let's choose an action. Let's go work. Ah, look at that.
Our current grade is a 75. Assignments left is four, but it should have added points to it, right? Now it's losing points. Okay, so now we need to go find the math of where when we do work, it should add points to it. It's probably in the same section. Grade plus equals points. Points equals complete assignment. So it gets a random number and we plus equals points to that. That should be working theoretically. Grade plus equals work work work. It's subtracting one for some reason. Current grade. Let's see what happens to our current grade. No, I thought I was wrong. I forgot when we put down here that the assignments left is larger than zero, we take lose points, an integer from 5 to 12 that will make us lose points too. So that's why the math looks wrong here. But now let's go notes. I think we have to actually restart it cuz we took too long. That's fine. Let's start fresh. My name is Joey. I am say I'm 19 years old first year in college.
I want to study and we can test it out with notes first. Another error. This is going to be one of those frustrating things where you just keep getting errors and errors and errors. Look, I can already tell you it's because I spelled boost amount wrong on line 33 it looks like or somewhere in here. Yeah, boost amount. That must be it, right?
Boost amount. Where's line 46? Using this for notes and we'll see what that means here in a little bit. But let's run it again. Joey 23. Let's study notes. There we go. So now we get an automatic bonus point, but we also are losing points because we still have assignments, right? So now let's go work and just work through these assignments like crazy. I'm getting a little bit, getting a little bit. And look at that, we end up with a 100. Can't really beat that.
>> The purpose of this video today was to show you that Python isn't just for data, isn't just this super boring typing on screen all day saying and, you know, and to some extent it is, but it can be fun, engaging, and not that complicated to learn. What I showed you guys today is what what sometimes takes people months to to sit down and learn on their own. It It takes months for my students to learn, right? So, it's a grind, and you notice I have errors throughout that I correct. We're all not perfect. We all have typos. We all forget something as we go. No matter what stage of game dev you are in, AAA god, just beginning, or somewhere in between, if you understand the logic from this video, you can start making games today. If you like this video, please give it a like and a subscribe.
If you want more videos like this, or like a tutorial playlist on coding with Python, please leave a comment with your opinions.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 viewsโข2026-05-28
How agent o11y differs from traditional o11y โ Phil Hetzel, Braintrust
aiDotEngineer
450 viewsโข2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation๐ฏโ
LearnwithSahera
1K viewsโข2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 viewsโข2026-05-29
Search Algorithms Explained in 60 Seconds! ๐ค๐จ
samarthtuliofficial
218 viewsโข2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 viewsโข2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 viewsโข2026-05-29
So What's Odin Lang Even Good For
TechOverTea
131 viewsโข2026-06-01











