::: {#navbar .navbar .navbar-default .navbar-fixed-top role="navigation"}
::: {.container}
::: {.navbar-header}
[]{.icon-bar} []{.icon-bar} []{.icon-bar}

<div>

[![](../_static/img/RAIcon.png)](/runestone/default/user/login){.brand-logo}
[fopp](../index.html){#rs-book-toc-link .navbar-brand}

</div>
:::

::: {.navbar-collapse .collapse .navbar-ex1-collapse}
-   
-   []{#ad_warning}
-   []{#browsing_warning}
-   
-   [*[Search]{.visuallyhidden
    aria-label="Search"}*](#){.dropdown-toggle}
    -   [Table of Contents](../index.html)

    -   [Book Index](../genindex.html)

    -   

    -   ::: {.input-group}
        :::
-   
-   [*[User]{.visuallyhidden aria-label="User"}*](#){.dropdown-toggle}
    -   []{.loggedinuser}

    -   

    -   [Course Home](/ns/course/index)

    -   [Assignments](/assignment/student/chooseAssignment)

    -   [Practice](/runestone/assignments/practice)

    -   [[Peer Instruction
        (Instructor)](/runestone/peer/instructor.html)]{#inst_peer_link}

    -   [Peer Instruction (Student)](/runestone/peer/student.html)

    -   

    -   [Change Course](/runestone/default/courses)

    -   

    -   [[Instructor\'s
        Page](/runestone/admin/index)]{#ip_dropdown_link}

    -   [Progress Page](/runestone/dashboard/studentreport)

    -   

    -   [Edit Profile](/runestone/default/user/profile){#profilelink}

    -   [Change
        Password](/runestone/default/user/change_password){#passwordlink}

    -   [Register](/runestone/default/user/register){#registerlink}

    -   [Login](#)

    -   ::: {.slider .round}
        :::

        Dark Mode
-   
-   [[*[Scratch Activecode]{.visuallyhidden
    aria-label="Scratch Activecode"}*](javascript:runestoneComponents.popupScratchAC())]{#scratch_ac_link}
-   
-   [*[Help]{.visuallyhidden aria-label="Help"}*](#){.dropdown-toggle}
    -   [FAQ](http://runestoneinteractive.org/pages/faq.html)
    -   [Instructors Guide](https://guide.runestone.academy)
    -   
    -   [About Runestone](http://runestoneinteractive.org)
    -   [Report A
        Problem](/runestone/default/reportabug?course=fopp&page=TuplePacking-Intro)
-   

```{=html}
<!-- -->
```
-   
-   [This Chapter](../index.html){.dropdown-toggle}
    -   [13.1 Introduction](TuplePacking-Intro.html){.reference
        .internal}
    -   [13.2 Tuple Packing](TuplePacking.html){.reference .internal}
    -   [13.3 Tuple Assignment with
        Unpacking](TupleAssignmentwithunpacking.html){.reference
        .internal}
    -   [13.4 Tuples as Return
        Values](TuplesasReturnValues.html){.reference .internal}
    -   [13.5 Unpacking Tuples as Arguments to Function
        Calls](UnpackingArgumentsToFunctions.html){.reference .internal}
    -   [13.6 Glossary](Glossary.html){.reference .internal}
    -   [13.7 Exercises](Exercises.html){.reference .internal}
    -   [13.8 Chapter Assessment](ChapterAssessment.html){.reference
        .internal}
-   
-   
:::
:::
:::

::: {#continue-reading .container}
:::

::: {#main-content .container role="main"}
::: {#introduction .section}
[]{#tuple-packing}

[13.1. ]{.section-number}Introduction[¶](#introduction "Permalink to this heading"){.headerlink}
================================================================================================

You have previously seen tuples, a sequence type that works just like
lists except that they are immutable.

When working with multiple values or multiple variable names, the Python
interpreter does some automatic packing and unpacking to and from
tuples, which allows some simplifications in the code you write.

::: {#learning-objectives .section}
[13.1.1. ]{.section-number}Learning Objectives[¶](#learning-objectives "Permalink to this heading"){.headerlink}
----------------------------------------------------------------------------------------------------------------

At the end of this chapter, you will be able to:

-   Recognize when code is using implicit tuple packing

-   Use implicit tuple packing to return multiple values from a function

-   Read and write code that unpacks a tuple into multiple variables

-   Learn a common pattern that unpacks the results of calling enumerate
    on a sequence
:::
:::

::: {style="width: 100%"}
::: {ea-publisher="runestoneacademy" ea-type="image" style="display: flex; justify-content: center"}
:::
:::

::: {#scprogresscontainer}
You have attempted []{#scprogresstotal} of []{#scprogressposs}
activities on this page

::: {#subchapterprogress aria-label="Page progress"}
:::
:::

-   [[](toctree.html)]{#relations-prev}
-   [[](TuplePacking.html)]{#relations-next}
:::

::: {.container}
[]{#numuserspan}[]{.loggedinuser} \| [Back to top](#)

© Copyright 2017 bradleymiller. Created using
[Runestone](http://runestoneinteractive.org/) 7.2.10.
:::
