Editor

Create a Tuple and Access Elements

Beginner · Write the code · from Python Tuples: When and Why to Use Immutable Sequences

From the lesson: Python Tuples: When and Why to Use Immutable Sequences

Think about GPS coordinates. A location like (40.7128, -74.0060) represents New York City. If you accidentally changed one of those numbers, the location would point somewhere completely different. Some data simply should not change after you create it.

Read the lesson

Create a tuple called seasons containing the four seasons as strings: 'Spring', 'Summer', 'Fall', 'Winter'.

Then print the first and last season, each on its own line.

Expected output:

Spring
Winter
# Create the seasons tuple
# Print the first season
# Print the last season

More Tuples exercises

All Python exercises · 50 practice problems · Data Structures quiz