thecodezone.
The Code Zone
Short steps, at your pace · Free lessons and practice · Member video walkthroughs
Save your next small win.

Checking your account…

03.08 · Python basics / Practice · 6 min

Make the placeholders display values

The message has the right placeholders, but Python is printing them literally. Enable the missing formatting.

Activity 8 of 19 in Python basics

All courses

Python Basics / 03.08

Practice formatted strings

Not started

Fix a sentence that prints variable names inside braces instead of the learner’s details.

More options

Your lesson progress

Walkthrough: not startedPractice: not started

Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.

Rob spots literal name and city placeholders in a printed sentence and investigates the string prefix at his computer.
Rob’s comic strip · Python basics

Build it one step at a time

Prefer learning by typing? Work through short instructions, run the Python code and check each change before continuing. Your guided project saves separately from the challenge below.

The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.

Start mini-lesson(opens in a new tab)

4 steps · Saved work · Instant feedback

YOUR TURN

Turn the placeholders into learner details

Keep learner_name assigned to "Ada" and learner_city assigned to "Miami". Make introduction an f-string that reads both variable values inside braces. Keep the print call. To pass: both variables must keep their values, introduction must hold "Ada lives in Miami.", and that sentence must print exactly once. After passing, try another city and rebuild the introduction to see it change.

Expected output
Ada lives in Miami.

Keep the starting inputs. Print these lines in this order, without extra output.

  • learner_name still holds Ada
  • learner_city still holds Miami
  • introduction holds Ada lives in Miami.

Edit Python, then run it. Check challenge checks your output and the listed Python requirements. Your code saves on this browser after a short pause. Sign in and choose Save account draft to keep it across devices. Word wrap is enabled.

Ready to checkRun the checks to see your results here.

Need a nudge?

Look before the opening quote

Braces inside an ordinary string are just characters. Compare the string prefix with the f-string example in the lesson.

Read the names inside the braces

Use learner_name and learner_city without quotes inside the braces. Keep the space on each side of lives in and the final period.

Replace your editor code?

Your current work will be replaced. Choose Cancel to keep it.

Ready to try it?

Practice in your browser and see your results.

Progress details

Have a question?

Ask the Code Zone community.

Ask a question in The Code Zone (opens in a new tab)

Continue learning

ONE STEP FORWARD

You inserted named values into a sentence. String methods are next in the original course order.