Example:
tuple = ("python", "includehelp", 43, 54.23)
Set is a collection of multiple values stored in a common name.
Example:
set = {"a", "includehelp", 43, 54.23}
Converting set into tuple and tuple into set
Python allows interconversion between two types of collections. This is easily done by passing the other type of collection in the creation function of the collection.
- To convert to Tuple : tuple(collection)
- To convert to Tuple : set(collection)
Program to convert set to Tuple in python
Output:
Program to convert Tuple into Set in python
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer