Created
June 2, 2020 15:43
-
-
Save JohnsonLuu/e15167e2cf1a0f804e20ade807e40292 to your computer and use it in GitHub Desktop.
This file contains 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
""" | |
Write a function named larger_list that has two parameters named lst1 and lst2. | |
The function should return the last element of the list that contains more elements. If both lists are the same size, then return the last element of lst1. | |
""" | |
#Write your function here | |
def larger_list(lst1, lst2): | |
if(len(lst1) >= len(lst2)): | |
return lst1[-1] | |
else: | |
return lst2[-1] | |
#Uncomment the line below when your function is done | |
print(larger_list([4, 10, 2, 5], [-10, 2, 5, 10])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment