Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created August 30, 2021 22:47
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 IndhumathyChelliah/6a8c45ed6a4da274bc02763056201f04 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/6a8c45ed6a4da274bc02763056201f04 to your computer and use it in GitHub Desktop.
original_list=[1,2,3,5,6,7]
#Copying list using list comprehension
copied_list=original_list[::2]
print(copied_list)
#Output:[1, 3, 6]
print(original_list)
#Output:[1, 2, 3, 5, 6, 7]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment