Created
February 21, 2018 09:39
-
-
Save iamshadmirza/67b8d24772e38184e8b174e2cd7b5e5f to your computer and use it in GitHub Desktop.
output first and last element of list
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 inserlist(givenlist): | |
first, *middle, last = givenlist | |
newlist = [first, last] | |
return newlist | |
list = [12,45,78,45,96,67,81,39] | |
print("List to be clipped is",list) | |
print("First and the last element of clip are",inserlist(list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment