-
-
Save IndhumathyChelliah/1d2ca666db53f6d9ae82e395521ecfc3 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
t=('red','blue','green',1,2,3) | |
#starts from first index and ends at second index.(third index not included) | |
print (t[1:3]) #Output: ('blue', 'green') | |
#starts from first index till end of tuple | |
print (t[1:])#Output: ('blue', 'green', 1, 2, 3) | |
# returns tuple containing all elements. | |
print (t[:]) #Output: ('red', 'blue', 'green', 1, 2, 3) | |
#starts from beginning till second index. | |
print (t[:3]) #Output:('red', 'blue', 'green') | |
print (t[-3:-1]) #Output:(1, 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment