Walkthrough Tuples In Python


I have just watched the Walkthrough Tuples in Python video and I am confused about where you actually write a Tuple.
The link to the exercise is https://www.codecademy.com/courses/learn-python-3/videos/learn-python3-tuples

Do you just write then in the code editor and run them or write them directly in the terminal? I tried both ways and neither worked.

Any help would be much appreciated!



If I’ve interpreted your question correctly then the code editor would be the one, here’s an example or two-

# create a tuple- example_tuple = 1, 2, 3, print(type(example_tuple)) # how is a tuple normally represent vs. lists- example_list = [4, 5, 6,] print(f"{example_tuple}\n{example_list}") # like lists we can stick in any objects- c = example_tuple, example_list, print(type(c)) def func(a, b): pass # when passing tuples around we often use parentheses- func(a=3, b=(1, 2, 3,)) # the second argument here is a single tuple object