Created
July 24, 2016 07:46
-
-
Save Nishan8583/436f5a392bca43fcdc5c5ac2b83a4ed0 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
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