Last active
June 20, 2022 02:39
-
-
Save paramire/79cccc53bf2e823fb9665156dc37ce98 to your computer and use it in GitHub Desktop.
longText - Issue 252
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
# -*- coding: utf-8 -*- | |
import sys | |
import unicodedata | |
def is_vowel(char): | |
_char = unicodedata.normalize('NFKD', char) | |
if _char[0].lower() in 'aeiou': | |
return True | |
return False | |
def longText(word, expand): | |
if sys.version_info[0] < 3: | |
word = word.decode('utf8') | |
char_list = [ | |
c * expand if is_vowel(c) else c | |
for c in word | |
] | |
return ''.join(char_list) | |
if __name__ == "__main__": | |
print(longText('hello world', 3)) | |
print(longText('lol', 10)) | |
print(longText('Árbol', 5)) # spanish | |
print(longText('Füße', 7)) # deutch | |
print(longText('mākonis', 3)) # latvia |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment