Square the Digits
Sometimes it is useful to break a number into digits, transform each digit, and then build a new number from the result. Write square_digits, which takes a non-negative number num, squares each of its digits, joins those squared values together, and returns the result as a number. For example, the digits 9, 1, 1, 9 become 81, 1, 1, 81.
Примеры
Ввод
9119Вывод
811181Ввод
0Вывод
0Ввод
123Вывод
149Нужно реализовать
def square_digits(num: int) -> int:
Теги
mathstrings
Logga in för att se historik över inskick
Logga inLogga in för att använda AI-mentorn
Logga inVisible tests
1
Input
9119Expected
8111812
Input
0Expected
03
Input
123Expected
1494
Input
9Expected
815
Input
2468Expected
41636646
Input
122Expected
144Focus radio
Paused · SomaFM · Fluid