VOOZH about

URL: https://www.codecademy.com/resources/docs/python/built-in-functions/tuple

⇱ Python | Built-in Functions | tuple() | Codecademy


Skip to Content

Python tuple()

Preview: @BrandonDusch 578 total contributions
@BrandonDusch

578 total contributions

Published Oct 14, 2022

The built-in tuple() function creates a new tuple.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 CoursesIncludes 6 Courses
    • With Professional CertificationWith Professional Certification
    • Beginner Friendly.
      75 hours75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With CertificateWith Certificate
    • Beginner Friendly.
      24 hours24 hours

Syntax

tuple_instance(iterable)

The iterable parameter is optional and is an object that can be looped over, such as a list or string. If an iterable is not provided, an empty tuple is created.

Codebyte Example

The following is an example of how the tuple() function is used to create a new tuple from a list:

Visit us
Visit us
Hide code
Code
Output
Hide output
Copy to your clipboard

All contributors

Learn Python on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 CoursesIncludes 6 Courses
    • With Professional CertificationWith Professional Certification
    • Beginner Friendly.
      75 hours75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With CertificateWith Certificate
    • Beginner Friendly.
      24 hours24 hours