CHAPTER 34   •   PYTHON

Python Tuples

Learn how to use immutable collections.

01 What is this?

Learn how to use immutable collections.

02 Syntax

Python Syntax
items = (value1, value2)

03 Example

Python Example
colors = ('Red', 'Green', 'Blue')
print(colors)

04 Important Points

Tuples cannot normally be changed after creation.

05 Common Mistakes

Do not try to modify tuple items directly.

06 Real World Use

Tuples are useful for fixed collections of values.

07 Practice This Topic

Now try the example yourself in the AIFA Python Editor.

  • Read the example carefully.
  • Change the values.
  • Run the code.
  • Observe the output.
  • Try creating your own example.
Try It Yourself →