Created
June 5, 2019 13:01
-
-
Save smhatre59/a65c23aa8fb2d883afcaf03d54257204 to your computer and use it in GitHub Desktop.
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
sampleTuple = (12, 10, 14, 18, 20, 22, 12) | |
#print a tuple | |
print(sampleTuple) | |
#Output: (12, 10, 14, 18, 20, 22, 12) | |
#print number of times 12 appears in the tuple | |
print(sampleTuple.count(12)) | |
#Output: 2 | |
#Search for the first occurrence of the value 14, and return its position: | |
print(sampleTuple.index(18)) | |
#Output: 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment