Repeat the vowels in a string for a specified number of times
Input
- text [str]
- volume [int]
Output
- shout [str]
Endpoint
https://hub.xpub.nl/soupboat/si16/api/shout/
?
text=<text>
&
volume=<volume>
Shout
This function take a text and shouts it LOUD. It repeats the vowels for a specified number of times.
def shout(text: str, volume: int = 5) -> str:
"""Repeat the vowels in a string for a specified number of times"""
shouted_text = ''
for c in text:
character = c
if c.lower() in ['a','e','i','o','u','y']:
character = character * volume
shouted_text = shouted_text + character
return shouted_text
Examples
shout('help')
'heeeeelp'
The first parameter is the text you want to shout. It can be anything, like a terrorized cry or a drunk song at 4am outside the pub. If you want to scream louder you can specify a second parameter for the volume. This is a number and by default is 5. It has to be positive but there are no limits to it.
shout('HELP', 10)
'HEEEEEEEEEELP'
You see, this is very a dangerous situation.
shout('OMG HELP', 0)
'MG HLP'
A muted scream