Format II: Argument Indices

Published by Alessandro Manicone in

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

Write a template string according to the following example:

Example

a = "John"
b = "Joe"
template = "yourtemplatestringhere"

template.format(a, b) ➞ "Joe hit John and then John hit Joe."

Tips

Writing a number n inside a place holder will tell .format() to fill in with the nth argument. For example:

"{0} said: Hi, I'm {0}.".format("Monica") ➞ "Monica said: Hi, I'm Monica."

Notes

  • Submit a string, not a function.
  • Do not change the name of the variable template.
  • You can find all the exercises in this series over here.
Watch a quick demo on how Edabit works.