Skip to content

Instantly share code, notes, and snippets.

@iamshadmirza
Created February 21, 2018 09:39
Show Gist options
  • Save iamshadmirza/67b8d24772e38184e8b174e2cd7b5e5f to your computer and use it in GitHub Desktop.
Save iamshadmirza/67b8d24772e38184e8b174e2cd7b5e5f to your computer and use it in GitHub Desktop.
output first and last element of list
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