fix issue with beautification
All checks were successful
build

This commit is contained in:
Joe Kaufeld 2023-03-31 23:55:45 -04:00
parent f41a9f9966
commit cf61dcf705
2 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -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: