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
Connectez-vous pour voir l'historique des soumissions
Se connecterConnectez-vous pour utiliser le Mentor IA
Se connecterVisible 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