You’ve stepped back into the neon glow of Loop Quest, the legendary arcade tucked away at the far end of Pixel Plaza. Rows of flickering CRT monitors line the walls, each running ancient code that repeats… endlessly. Somewhere deep inside the circuits of these machines lies a mystery: how do the programs know to repeat themselves?
Today, you’ll unlock the heart of every classic game — the loop.
Just like Pac-Man endlessly chasing dots or Space Invaders spawning waves of enemies, loops keep the action alive without you having to write the same line of code a hundred times.
A loop is a coding mechanism that lets your program perform a task multiple times without copy-pasting the same commands.
Imagine Donkey Kong throwing barrels. You don’t need to code every single barrel toss — one loop handles them all!
Without loops, your Python game would feel like a single-round demo.
With loops, it runs forever (or at least until the player loses all their lives).
Because nobody wants to type the same thing over and over and over again!
The for loop is Python’s go-to way to cycle through lists — kind of like your game engine cycling through enemies on the screen.
Think of it like this:
element = a variable that takes each value from the list one by one
sequence = your list (like a list of enemies, levels, or power-ups)
And don’t forget that colon! It’s the coin you insert to start the loop.
Anything you want to run INSIDE the for loop must be equally INDENTED
Think of the for loop as a box, and inside that box, you want code to run
We want to print that all the Pac-Man Ghosts are chasing Pac-Man...
We could print 4 Separate Lines, but that's really boring
Instead, Let's try this!
Think of ghosts as the entire roster of enemies — all four ghosts together, sitting in the maze, waiting to move.
Now think of ghost as one ghost at a time — the one currently being processed by your game loop.
In English:
ghosts (plural) = the list of all ghosts.
ghost (singular) = a single element from that list.
So on the first run, ghost = "Blinky".
Next time through, Python updates it: ghost = "Pinky".
And so on until it runs out of names
Programmers use plural for collections and singular for loop variables because it makes your code easy to read.
Imagine you’re walking through the Arcadia Arcade, clipboard in hand, writing down every game you see
Without enumerate(), you’d have to keep track of the numbers yourself:
“Okay, this is game #1… that’s game #2… that’s game #3…”
That’s what most beginner programmers do — they count manually.
But Python has a built-in helper that does this for you: enumerate( )
When you loop through a list, enumerate() gives you two things every time:
A number (the position in the list)
The item itself
You get to use both at once — no math, no manual counting.
You need 2 things! You have to have a variable to store the number, and you need the ITEM too!!
Each time through the loop:
Python takes the next game from the list
Automatically gives it a count number
Runs your print statement using both values
The year is 1987, and deep inside the glowing halls of Arcadia Mall, a VHS rental corner called RetroFlix is still running strong. Rows of boxy CRTs hum as movie trailers play on loop, and the smell of popcorn fills the air.
You’ve been hired as the night operator — your task: build the digital movie marquee using Python. The RetroFlix terminal only understands lists and loops, so you’ll have to load tonight’s titles the old-fashioned way.
Tonight’s mission is to build the digital movie marquee for RetroFlix.
You’ll ask the user to enter their favorite movie titles, one by one, and then print them out in a numbered list — just like a real theater lineup!
Have users enter in 5 movies
Once they've done that add them to a list of movies
LOOP THROUGH THE LIST in order to create a movie theater listing!!
The neon glow of Arcadia Mall flickers against the glass doors of the Cineplex lobby.
Somewhere deep in the projection booth, a beige CRT monitor hums to life. The terminal blinks a single line:
ARCADIA CINEPLEX MAINFRAME v1.87 — ENTER SHOWTIME DATA
You are the Night Operator, the same brave soul who once programmed the RetroFlix rental booth down the hall. But tonight’s job is bigger: You’re building the entire schedule for all five films playing at the Arcadia Cineplex.
That means not just one list… but lists inside lists.
At RetroFlix, a single list was enough. You’d store movie titles like this:
movies = ["Back to the Future", "The Matrix", "Jurassic Park", "Toy Story", "Spirited Away"]
But now the Cineplex needs to know Each movie’s multiple showtimes, and be able to print them together neatly. If we just put all showtimes in one long list, Python wouldn’t know which movie they belong to.
showtimes = ["10:00 AM", "12:30 PM", "3:00 PM", "7:00 PM", "11:00 AM", "1:45 PM", "9:00 PM"]
That’s chaos!!
Python lets us build a list of lists — a structure that groups related items together.
Now, each inner list represents one movie’s set of times.
Python sees this like a theater schedule — rows of information, perfectly stacked.
Think of it like a movie theater spreadsheet:
Rows = movies.
Columns = times.
A nested loop means:
👉 One loop is running inside another loop.
Think of it like a movie theater:
Outer list = all movies’ schedules (the whole board) → showtimes
Outer index = which movie row you want → showtimes[row]
Inner index = which time in that row → showtimes[row][col]
11:42 PM. The lobby is packed, the popcorn machine is crying, and the Arcadia Cineplex phone won’t stop ringing. The manager bursts into the projection booth, waving a crumpled print-out:
“The Matrix sold out every seat! Add two more showtimes before midnight!”
You sigh, crack your knuckles, and type a new command into the terminal. It’s time to update your lists — because in Python, even blockbuster chaos can be handled with a simple loop.
Asks the user to enter information for 4 different TV shows.
Stores this information in a list of lists format.
Uses a for loop to display the stored information.
Create a blank list called: shows = []
Prompt a user to enter the following (for 4 shows):
Show Title
Show Rating (1-5 Stars)
Show Description
Store that information as a LIST OF LISTS by adding the title, rating and description to the shows list, as a SINGLE ENTRY
Once done, print the information like below...
Adding show info to your list...
shows = [ ]
shows.append([Title, Rating, Description]
How to access them??
show[0] would be the title
show[1] would be the rating
show[2] would be the description
BUT, they're already in a list... maybe this??
shows[0][0] or shows[0][1] or shows[0][2]
OR USE A FOR LOOP SINCE IT'S WAY EASIER!!! HOW???!!
Display the rating not as a number, but using images:
Example:
⭐ ⭐🌟🌟🌟 would be 2 / 5
⭐ ⭐⭐ ⭐🌟 would be 4 /5
Can you figure out a way to add a RATINGS Field to each of the TV/Shows or movies which includes the following? And, then get each of them to display in a really cool chart for each show?
IMDB Rating (1-5)
MPAA Rating (G, PG, PG-13)
Tomatometer Rating (0-100%)
If you can figure out something like this, you'll get an extra 100. Here's a hint and some help below... You may also need int() and // division