parent
f41a9f9966
commit
cf61dcf705
@ -92,7 +92,6 @@ def beautify(words: list[str]):
|
|||||||
new_beautiful_string = []
|
new_beautiful_string = []
|
||||||
|
|
||||||
for num, letter in enumerate(message):
|
for num, letter in enumerate(message):
|
||||||
if letter in string.ascii_letters:
|
|
||||||
if num % 2:
|
if num % 2:
|
||||||
letter = flip_char(letter)
|
letter = flip_char(letter)
|
||||||
new_beautiful_string.append(letter)
|
new_beautiful_string.append(letter)
|
||||||
|
@ -2,6 +2,9 @@ import string
|
|||||||
|
|
||||||
|
|
||||||
def flip_char(char: str):
|
def flip_char(char: str):
|
||||||
|
if char.lower() not in string.ascii_letters:
|
||||||
|
return char
|
||||||
|
|
||||||
if char in string.ascii_lowercase:
|
if char in string.ascii_lowercase:
|
||||||
return string.ascii_uppercase[string.ascii_lowercase.find(char)]
|
return string.ascii_uppercase[string.ascii_lowercase.find(char)]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user