Insert Into Wrapper

Sometimes you have a ready-made wrapper string and need to place a value neatly inside it, like text inside brackets or a button inside a template. Write a function make_out_word that takes a wrapper string out of length 4 and a word word. Split out into two equal parts and insert word between them.

Примеры

Ввод
"<<>>", "Yay"
Вывод
"<<Yay>>"
Ввод
"<<>>", "WooHoo"
Вывод
"<<WooHoo>>"
Ввод
"[[]]", "word"
Вывод
"[[word]]"

Нужно реализовать

def make_out_word(out: str, word: str) -> str:

Теги

strings
PostgreSQLv16

Tukaj bo rezultat izvajanja kode

Visible tests
1
Input
"<<>>", "Yay"
Expected"<<Yay>>"
2
Input
"<<>>", "WooHoo"
Expected"<<WooHoo>>"
3
Input
"[[]]", "word"
Expected"[[word]]"
4
Input
"<<>>", ""
Expected"<<>>"
5
Input
" ", "WooHoo"
Expected" WooHoo"
6
Input
"<<>><<>>", "Yay!"
Expected"<<Yay!>><<>>"
Focus radio
Paused · SomaFM · Fluid