Raindrop Sounds
In this exercise, a number turns into a short "raindrop" string based on divisibility rules. The function convert receives number and adds Pling if it is divisible by 3, Plang if it is divisible by 5, and Plong if it is divisible by 7. If none of the rules match, return the number itself as a string.
Примеры
Ввод
3Вывод
"Pling"Ввод
5Вывод
"Plang"Ввод
7Вывод
"Plong"Нужно реализовать
def convert(number: int) -> str:
Теги
stringsmath
Logáil isteach chun stair na n-aighneachtaí a fheiceáil
Logáil isteachLogáil isteach chun an Meantóir IS a úsáid
Logáil isteachVisible tests
1
Input
3Expected
"Pling"2
Input
5Expected
"Plang"3
Input
7Expected
"Plong"4
Input
15Expected
"PlingPlang"5
Input
105Expected
"PlingPlangPlong"6
Input
34Expected
"34"Focus radio
Paused · SomaFM · Fluid