← Back to challenges

Format VII: Truncating Strings

PythonHardstringsformattinglanguage_fundamentals

Instructions

For each challenge of this series you do not need to submit a function. Instead, you need to submit a template string that can formatted in order to get a certain outcome.

Write a template string according to the following example. All final strings must have a length of 20 characters:

Example

template = "yourtemplatestringhere"
template.format(fname = "John", lname = "Doe") ➞ "JoDo###############."

Tips

The placeholder {:.x} will truncate a string at index x:

"My initial is {:.1}.".format("Innokodakademija") ➞ "My initial is E."

Notes

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: The Sweetest Ice Cream