Python tuple()
Published Oct 14, 2022
Contribute to Docs
The built-in tuple() function creates a new tuple.
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:
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
- With Certificate
- Beginner Friendly.24 hours