Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions 023_string_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@

# == Exercise One ==

print("")
print("get_first_letter")
print("Function: get_first_letter")

def get_first_letter(the_str):
# Return the first letter of the string
pass
return(note[0:3])

check_that_these_are_equal(
def check_that_these_are_equal(
get_first_letter("The king granted them"),
"T"
)
Expand All @@ -66,13 +66,17 @@ def get_first_letter(the_str):

# == Exercise Two ==

print("")
print("get_last_letter")
print("Function: get_last_letter")

def get_last_letter(the_str):
# Return the last letter of the string
pass
return the_str[0]

def check_that_these_are_equal(actual, expected):
assert actual == expected, f"Expected {expected}, but got {actual}"

# Example usage and check
check_that_these_are_equal(
get_last_letter("The king granted them"),
"m"
Expand Down