Add python/raindrops
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""This module provides a function to convert a number into a string that
|
||||
contains raindrop sounds corresponding to certain potential factors."""
|
||||
|
||||
def convert(number):
|
||||
"""Converts a number into a string that contains raindrop sounds
|
||||
corresponding to certain potential factors."""
|
||||
sound = ""
|
||||
digit=True
|
||||
|
||||
if number % 3 == 0:
|
||||
sound += "Pling"
|
||||
digit=False
|
||||
if number % 5 == 0:
|
||||
sound += "Plang"
|
||||
digit=False
|
||||
if number % 7 == 0:
|
||||
sound += "Plong"
|
||||
digit=False
|
||||
if digit: sound = f"{ number }"
|
||||
|
||||
return sound
|
||||
Reference in New Issue
Block a user