The quarter drops. The lights flicker. Ready, Player One — the code begins.
The game floor hums. The neon signs cast your reflection in green and purple bands.
Every time you hit Enter, the arcade responds — data shifting behind the glow, machines re-arranging in your simulated layout.
By the end of the night, you’ll have tamed the chaos of the floor — not with a soldering iron or screwdriver, but with:
extend() to expand the arcade
count() to track popularity
index() to pinpoint cabinets
shuffle() and choice() to keep the crowd guessing
copy() to save perfect layouts
clear() to wipe the slate clean for the next day
extend() adds every item from another iterable to the end of your list.
It changes the original list.
Use extend() to merge your shipment into the floor list in one move.
Management swears Galaga prints money. You need a quick count of how many are on the floor.
No loops, no fuss—just the number.
The janitor radioed: “Where’s Donkey Kong? Slurpee spill in Aisle 3.”
index() gives you the position instantly.
index(x) returns the first index where x is found (0-based).
If it isn’t there, it would error—so only call it when you know it exists.
random.shuffle() doesn’t make a new list;
it physically rearranges your current one. It’s like the arcade elves worked overnight.
random.shuffle(list) permanently changes the order — the original list is randomized.
Use it when you want variety or randomness without creating a copy.
random.choice() doesn’t alter your floor—it simply picks a star for the show.
random.choice(list) chooses one random element from your list.
It doesn’t delete it—it just highlights it. Think of it as the “Wheel of Fortune” of your arcade.
copy() lets you clone your list, preserving its exact state, untouched by whatever chaos follows.
copy() creates a new independent list.
It’s perfect for backups before risky changes like shuffle() or sort().
clear() empties a list instantly, like turning off every CRT screen in one command.
clear() removes all elements, but the list object remains.
Use it for resets, logs, or temp data you no longer need.
The mall is closed. The escalators hum quietly. Down in the far wing of Arcadia Mall, a flicker of neon light pulses behind the locked gates of Pixel Palace.It’s your first solo night shift as Arcade Operator, and Gary (your well-meaning but hopelessly analog manager) left you a sticky note that says:
“Prep the floor, log the numbers, pick the spotlight, and make sure we don’t have another Galaga meltdown. Don’t forget to clear last night’s report. — G”
You can use the following code (copy and paste into your game, in order to set up your initial arcade.
arcade_floor is the list of cabinets in your arcade
crate_1 is the set of games you ordered
The loading dock rattles open and two forklifts beep into reverse. Shrink-wrapped cabinets slide out in rows: Bubble Bobble, Rampage, Joust, Gauntlet II, and more. The palace already has a base lineup humming on the floor. Your job is to absorb both shipments into the live rotation so tomorrow’s crowd thinks the arcade grew overnight.
Start with a base floor list of game titles and the crate_1 list.
Prompt the user to create crate_2, which will have 5 more games. They can be unique, or duplicates to things you already have.
Create a shipment list that is made up of crate_1 and crate_2, so both of those crates are merged (hint: extend())
Print a simple “inventory” list (one title per line) of:
Original Games On The Floor:
Crate 1
Crate 2
Shipment List (crate 1 and crate 2)
If you look at the sample output, you'll see that you show the existing cabinets, as well as the ones that you're expecting to get!! This is just a small sample! Your list may be a LOT Bigger!
Right now the layout is sensible—aisles are clear, joysticks gleam. But the second you begin the remix, there’s no “undo” on a real row of 400-pound machines. So you do what every veteran operator does before a big move: save a snapshot of the current plan.
What you must do
Make an exact copy of floor, and your shipment (call it backup_floor, backup_shipment) using copy().
NEVER CHANGE THESE. Treat them like museum pieces.
Print the lists with clear labels to prove the backup matches the original.
What you must do
Use random.shuffle(floor) to randomize the order in place.
Print the new layout as a numbered list: “Cabinet 1: ____”.
Keep backup_floor unchanged and available for comparison later.
The lights dim; you hear a faint synth pad from the prize counter radio. A single command sends the entire lineup into a fresh order, the way the palace secretly keeps regulars from grinding the same corner cabinet forever.
A red marquee near the entrance features a different machine every night. Its screen faces the mall, whispering, “One more token.” The choice must feel fair—so you leave it to fate.
What you must do
Use random.choice(floor) to select a single game and store it as spotlight.
Print a bold line like: Tonight’s Spotlight: <title>.
What you must do
Use count() on the shuffled floor to compute how many "XXXXX" cabinets are present.
Print the result with a clear label (e.g., Galaga Machines on Floor: 2).
(If there are none in your data, pick another crowd favorite and count that.)
Gary swears the palace can’t have too many Galaga machines. The power bill disagrees. You need a fast tally to keep the peace.
The marketing intern is printing a map for the front door. They need to know exactly where the featured cabinet lives in tonight’s layout.
What you must do
Use index() on floor to find the position of spotlight.
Print its human position (add 1 to the index): Centipede is at cabinet number 4.
Keep your wording clean and terminal-friendly.
The mop bucket squeaks by; tokens clatter in a drawer. You generate a small closing report—tokens, tickets, repairs—and archive it. The next operator needs a clean slate.
What you must do
Create a list called closing_log with three short strings, e.g., "Tokens Collected: 2040", etc.
Print the full log as a single line, then on separate lines.
Call clear() on closing_log, then print it again to demonstrate it’s empty.
Gary’s in a panic again. A crowd of players is forming around the prize counter, shouting:
“The Out Run machine’s down! Where’s the backup cabinet?!”
You’ve got the entire floor lineup displayed on your terminal, but you need to quickly find where the first copy of a given game is located — before the chaos spreads to the skee-ball lanes.
Display a short menu of cabinet names (like a mini catalog).
Ask the user which one they want to locate.
Print out a line showing the first cabinet number where that game appears on the floor.
💡 Hint: The Pixel Palace terminal can find the first matching cabinet in a list all by itself — you just have to tell it what to look for.