Skip to content

Instantly share code, notes, and snippets.

@kubilaykaand
Last active September 11, 2021 18:11
Show Gist options
  • Save kubilaykaand/2611f23f233ae22a044ad0e6e632760b to your computer and use it in GitHub Desktop.
Save kubilaykaand/2611f23f233ae22a044ad0e6e632760b to your computer and use it in GitHub Desktop.
tuple and list slicing example
piano_keys=["a","b","c","d","e","f","g"]
piano_tuple=("do","re","mi","fa","so","la","ti")
print(piano_tuple[2:5])#example for tuple, ( ) while assigning, [] while manipulating
print(piano_keys[2:5:2])#example for list, [] while assigning, () while manipulating
print(piano_keys[::2])
print(piano_keys[::-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment