From 980d8677e829ff5e1907fd15196304fa9b5fc309 Mon Sep 17 00:00:00 2001 From: Jordan1-34 <131589592+Jordan1-34@users.noreply.github.com> Date: Sat, 3 Aug 2024 19:48:37 +0100 Subject: [PATCH] Update 023_string_indexing.py --- 023_string_indexing.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/023_string_indexing.py b/023_string_indexing.py index 75ead1a7..784e6e78 100644 --- a/023_string_indexing.py +++ b/023_string_indexing.py @@ -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" ) @@ -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"