Created
June 13, 2022 20:25
-
-
Save les-peters/8bcc5f49f4b583029d9b7e7802f4565e to your computer and use it in GitHub Desktop.
Long Text Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
question = """ | |
Create a loooong teeeext generator that takes in a string and an integer n, | |
and multiplies the vowels in the string by n. | |
Example: | |
$ longText('hello world', 3) | |
$ 'heeellooo wooorld' | |
$ longText('lol', 10) | |
$ 'looooooooool' | |
""" | |
import re | |
def longText(string, x): | |
string = re.sub(r'([aeiou])', r'\1' * x, string) | |
print(string) | |
return | |
longText('hello world', 3) | |
longText('lol', 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment