Wrap in Tags
HTML markup is a good example of building a ready-made text template from small strings. Write a function make_tags that takes a tag name tag and a word word. Return a string where the word is wrapped in an opening and closing tag: first <tag>, then the word, then </tag>.
Примеры
Ввод
"i", "Yay"Вывод
"<i>Yay</i>"Ввод
"i", "Hello"Вывод
"<i>Hello</i>"Ввод
"cite", "Yay"Вывод
"<cite>Yay</cite>"Нужно реализовать
def make_tags(tag: str, word: str) -> str:
Теги
strings
Pieslēdzies, lai redzētu iesniegumu vēsturi
PieslēgtiesPieslēdzies, lai izmantotu AI mentoru
PieslēgtiesVisible tests
1
Input
"i", "Yay"Expected
"<i>Yay</i>"2
Input
"i", "Hello"Expected
"<i>Hello</i>"3
Input
"cite", "Yay"Expected
"<cite>Yay</cite>"4
Input
"b", ""Expected
"<b></b>"5
Input
"ii", "Hello"Expected
"<ii>Hello</ii>"6
Input
"i!", "Hello"Expected
"<i!>Hello</i!>"Focus radio
Paused · SomaFM · Fluid