-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbite_225.py
More file actions
27 lines (18 loc) · 856 Bytes
/
bite_225.py
File metadata and controls
27 lines (18 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Online Python - IDE, Editor, Compiler, Interpreter
'''In this Bite you will swap case all pybites characters (both lower- and upper case) for a given text.
Not much more as for our instruction, just complete convert_pybites_chars which should work like this:'''
PYBITES = "Today we added TWO NEW Bites to our Platform, exciting!"
def convert_pybites_chars(text: str) -> str:
result = []
for word in text.split(" "):
chars = []
for char in word:
if char.islower():
chars.append(char.upper())
if char.isupper():
chars.append(char.lower())
else:
chars.append(char)
result.append(" ".join(chars))
return " ".join(result)
print(convert_pybites_chars("Today we added TWO NEW Bites to our Platform, exciting!"))