Skip to content

Commit faeaace

Browse files
committed
simple magic methods, upper, lower and strip added
1 parent c40e2a2 commit faeaace

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

024_string_operations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
new_string = old_string.replace("YOUR_NAME", "Kay")
4343

4444
# Uncomment this next line to see the result
45-
# print(new_string)
45+
print(new_string)
4646

4747
# You'll notice here that the function is coming in a
4848
# different place. Let's compare `len` and `replace`:
@@ -80,7 +80,7 @@
8080

8181
def make_uppercase(string):
8282
# Return the string in uppercase
83-
pass
83+
return string.upper()
8484

8585
check_that_these_are_equal(
8686
make_uppercase("hello"), "HELLO")
@@ -97,7 +97,7 @@ def make_uppercase(string):
9797

9898
def make_lowercase(string):
9999
# Return the string in lowercase
100-
pass
100+
return string.lower()
101101

102102
check_that_these_are_equal(
103103
make_lowercase("HELLO"), "hello")
@@ -115,7 +115,7 @@ def make_lowercase(string):
115115
def strip_whitespace(string):
116116
# Return the string with any whitespace removed from
117117
# the start and end
118-
pass
118+
return string.strip()
119119

120120
check_that_these_are_equal(
121121
strip_whitespace("hello "), "hello")

0 commit comments

Comments
 (0)