Skip to content

Instantly share code, notes, and snippets.

@Nishan8583
Created July 24, 2016 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nishan8583/436f5a392bca43fcdc5c5ac2b83a4ed0 to your computer and use it in GitHub Desktop.
Save Nishan8583/436f5a392bca43fcdc5c5ac2b83a4ed0 to your computer and use it in GitHub Desktop.
def listing():
list1 = [1,2,5,4,8,9,6,3,6,4,9,5]
list2 = []
counter = 0
for x in list1:
if counter == 0 or counter == (len(list1) - 1):
list2.append(list1[counter])
else:
pass # if condition is not matched then pass
print(counter)
counter += 1
print(list2)
listing()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment