Last active
September 11, 2021 18:11
-
-
Save kubilaykaand/2611f23f233ae22a044ad0e6e632760b to your computer and use it in GitHub Desktop.
tuple and list slicing example
This file contains hidden or 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
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