Add Number Strings
Sometimes numbers arrive in a program as strings, such as from a form, a file, or an API. Write a function sum_str that takes two strings a and b containing non-negative integers and returns their sum as a string too. An empty string should be treated as zero.
Примеры
Ввод
"4", "5"Вывод
"9"Ввод
"34", "5"Вывод
"39"Ввод
"", ""Вывод
"0"Нужно реализовать
def sum_str(a: str, b: str) -> str:
Теги
stringsmath
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięVisible tests
1
Input
"4", "5"Expected
"9"2
Input
"34", "5"Expected
"39"3
Input
"", ""Expected
"0"4
Input
"1", ""Expected
"1"5
Input
"100", "200"Expected
"300"6
Input
"100", "200200"Expected
"200300"Focus radio
Paused · SomaFM · Fluid