Skip to content

Instantly share code, notes, and snippets.

@ozgurozkok
Last active March 19, 2023 18:45
Show Gist options
  • Save ozgurozkok/a4f0d5ca7dfc072da87436d9b32c872d to your computer and use it in GitHub Desktop.
Save ozgurozkok/a4f0d5ca7dfc072da87436d9b32c872d to your computer and use it in GitHub Desktop.
#sample 1
#Here's an example of creating a tuple
my_tuple = (1, 2, 3, "four", 5.0)
#sample 2
#Tuples can also be created without using parentheses, using just commas:
another_tuple = "one", "two", "three"
#sample 3
#Here's an example that could produce this error message:
my_tuple = (1, 2, 3)
value = my_tuple.get(0)
#sample 4
#This code will retrieve the value at index 0 of the my_tuple tuple, which is 1.
my_tuple = (1, 2, 3)
value = my_tuple[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment