Practice Bank: Your First Python Program
A deeper set of practice problems, organized by topic, for extra reps
beyond the main exercises — including scenario-based problems
written in the same style you'll meet in real interviews. Still uses
only print(), variables, basic types, input(),
and string concatenation with + / str().
starter.py below, then run it from a terminal
with python3 starter.py.
Topic 1: print()
1 Two lines, two calls
Find # TODO 1.1. Print "Hello, World!", then print your own name — two separate print() calls.
2 Shipping label
Find # TODO 1.2. Print a 3-line shipping label: name, street address, city + zip — one print() call per line.
3 Decorative header
Find # TODO 1.3. Print a line of dashes, then a title, then another line of dashes.
4 Why three lines?
Find # TODO 1.4. Print "Loading..." three times in three separate calls, then add a comment explaining why each one lands on its own line.
5 Welcome banner
Find # TODO 1.5. Print a 2-line "Welcome" banner using symbols of your choice in the quoted text.
Internal tool startup banner
Find # TODO 1.A. Your team's internal CLI script needs a startup banner: print a title line, then a "Type --help for options" line.
Prove print() adds a newline
Find # TODO 1.B. An interviewer asks whether print() automatically starts a new line after each call. Write two calls and add a comment explaining what you expect to see and why.
Topic 2: Variables
1 Three variables, three types
Find # TODO 2.1. Store your name, age, and height in three variables and print each on its own line.
2 Reassignment
Find # TODO 2.2. Create score = 10 and print it, then reassign it to 20 and print again.
3 Order doesn't matter
Find # TODO 2.3. Create two variables holding different values, then print the second one first — to show a variable is just a label.
4 Running balance
Find # TODO 2.4. Create balance = 100 and reassign it three times in a row like a running total, printing after each change.
5 Copying a value
Find # TODO 2.5. Copy one variable's value into a second variable and print both to show they currently match.
Click counter
Find # TODO 2.A. Simulate 3 button clicks (no loops yet) by reassigning a click_count variable to 1, 2, then 3, printing after each one.
Debug: balance printed too early
Find # TODO 2.B. The code prints a bank balance before a deposit is added instead of after. Find the bug and fix the order.
Topic 3: Basic Types
1 One of each type
Find # TODO 3.1. Create a string, an int, and a float for a product listing, and print each with a label sentence using str().
2 Label + number
Find # TODO 3.2. Join the label "Total items: " with an int using str().
3 Debug the Code
Find # TODO 3.3. This line joins a string directly with an int and crashes with a TypeError. Fix it with str().
4 ID card sentence
Find # TODO 3.4. Build one sentence joining a name (string), age (int), and GPA (float) — converting the numbers with str() first.
5 Int vs. float
Find # TODO 3.5. Store the same number once as an int and once as a float, and print both to see how Python displays them differently.
Till receipt line
Find # TODO 3.A. Print a receipt line like Coffee - $4.50 by joining a string and a float with str().
Why does str() fix it?
Find # TODO 3.B. Explain in a comment why "Age: " + 30 crashes but "Age: " + str(30) doesn't.
Topic 4: input()
1 Personalized greeting
Find # TODO 4.1. Ask for the user's name with input() and print a personalized greeting.
2 Two questions, one sentence
Find # TODO 4.2. Ask for the user's name and favorite hobby with two input() calls, then combine both in one sentence.
3 Age as text
Find # TODO 4.3. Ask for the user's age as text and build a sentence combining it with other text using +.
4 Debug the Code
Find # TODO 4.4. This code joins input() text directly with an int variable and crashes. Fix it with str().
5 Two more questions
Find # TODO 4.5. Ask for the user's favorite food and season, then combine both answers into one sentence.
Mini Mad Libs
Find # TODO 4.A. Ask for a noun and an adjective, then print a silly sentence combining both with fixed text around them.
What type does input() return?
Find # TODO 4.B. Prove that input() always returns a string — even when the user types a number — by joining it directly with another string, no str() needed. Explain why in a comment, contrasting it with TODO 4.4.
solution.py. Your exact
wording doesn't need to match — the goal is that your program
runs without errors and does what each TODO asks.