Created
October 21, 2022 12:23
-
-
Save RaMSFT/e00831b1553256da58a39763cd2d7a65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_element_with_index(input_list, index_value): | |
try: | |
return f"Element value: {input_list[index_value]} at the index: {index_value}" | |
except: | |
return f"no element exists at the index {index_value}" | |
print(find_element_with_index(["hi", "edabit", "fgh", "abc"], 1)) | |
print(find_element_with_index(["Red", "blue", "Blue", "Green"], 2)) | |
print(find_element_with_index(["a", "g", "y", "d"], 10)) | |
print(find_element_with_index(["Pineapple", "Orange", "Grape", "Apple"], 3)) | |
print(find_element_with_index(["Pineapple", "Orange", "Grape", "Apple"], 100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment