Save this video free

Python (Fall 2026) Module 14-7: Using Classes in a Program

Bill Moseley, Ph.D. - Computer Science Educator · 9:50 · Watch on YouTube

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Python (Fall 2026) Module 14-7: Using Classes in a Program Watch on YouTube →

Overview

Bill Moseley demonstrates how Python classes and lists work together in a vehicle inventory program. The program stores car instances, lets users buy, list, and sell cars, uses numbered choices with `enumerate` and `pop`, and could preserve its inventory between runs by serializing the list with `pickle`.

Key takeaways

Chapters

0:00 Create and List Car Instances in a Python Inventory
3:20 Use Enumerated Numbers and pop to Sell a Car
7:56 Extend the Inventory and Persist Lists of Objects

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:02 So, how might I use this in a program? So, I'm going to create a little program here. Which will allow me to  manage my fleet of vehicles. So, I'm going to say strMenu = input, buy a car,

0:55 sell a car, list cars. Okay, so there's three  things in my menu choice. I'm going to make a choice here, and I'm going to say if strMenu == 1. If it equals one,  I'm going to buy a car. So, what do I want to do? I want to ask  strMake = input, what kind of car? And then I'm going to add that  to the, to the list of cars. So, I'm going to say liCars.append, and I'm  going to append the make that I just gave it. Okay. Elif strMenu, I'm going to jump  to the menu option, which is list cars,

2:02 before I do sell a car, because that's  going to be the, the last one that we do. So, I'm going to say, list the  cars is for obCar in liCars. Print obCar. Okay, so let's just run this. I'm going to buy a  car. Buy a car. What kind of car? Toyota. Okay. Oops. I didn't do the right thing.  All I did was append the list, the, the make to that list. I actually need to create  the car with the make as a, there we go. So, I'm actually instantiating a car. Before that,  I was just adding the string to the list. Silly

2:57 me. All right. So, buy car. What clued me in is  that it didn't say this, you bought a Toyota. So, let's buy another car. I'm going to buy  a Ford. Now, if I want to list my cars, there's my list of cars. So, that's pretty  easy. But, how do we sell a car? Because

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Bill Moseley, Ph.D. - Computer Science Educator.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.