String Sandwich
Joining strings is one of the most common operations in programming: it is how messages, templates, and labels are built. Write a function make_abba that takes two strings a and b. Return a new string in this pattern: first a, then b twice, then a again.
Примеры
Ввод
"Hi", "Bye"Вывод
"HiByeByeHi"Ввод
"Yo", "Alice"Вывод
"YoAliceAliceYo"Ввод
"What", "Up"Вывод
"WhatUpUpWhat"Нужно реализовать
def make_abba(a: str, b: str) -> str:
Теги
strings
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięVisible tests
1
Input
"Hi", "Bye"Expected
"HiByeByeHi"2
Input
"Yo", "Alice"Expected
"YoAliceAliceYo"3
Input
"What", "Up"Expected
"WhatUpUpWhat"4
Input
"", "y"Expected
"yy"5
Input
"abc", "Bye"Expected
"abcByeByeabc"6
Input
"Yo", "a"Expected
"YoaaYo"Focus radio
Paused · SomaFM · Fluid