One for You
This function builds a short phrase from a template, which is a good way to practice default parameters and strings. The function two_fer should return a string in the form One for X, one for me., where X is replaced by the given name. If no name is provided, use the default value you.
Примеры
Ввод
()Вывод
"One for you, one for me."Ввод
"Alice"Вывод
"One for Alice, one for me."Ввод
"Bob"Вывод
"One for Bob, one for me."Нужно реализовать
def two_fer(name: str = 'you') -> str:
Теги
strings
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediVisible tests
1
Input
—Expected
"One for you, one for me."2
Input
"Alice"Expected
"One for Alice, one for me."3
Input
"Bob"Expected
"One for Bob, one for me."4
Input
"Zaphod"Expected
"One for Zaphod, one for me."Focus radio
Paused · SomaFM · Fluid