List to Tuple conversion program in python

List to Tuple conversion program in python. This program will change or convert the list to a tuple in data structures in a python programming language. Using this program you can convert list element into tuple element.

lista = [10,45,76,34,67,13]
print(lista)
tuplea = tuple(lista)
print(tuplea)

 

Output:

[10, 45, 76, 34, 67, 13]                                      (10, 45, 76, 34, 67, 13)

What is list element in python

To make a list, put all of the items (elements) inside square brackets [] and separate them with commas. It can include an unlimited number of objects of various sorts (integer, float, string etc.). Another list can be included as an item in a list. This is referred to as a nested list.

What is tuple element in python

Multiple things can be stored in a single variable using tuples. Tuple is one of Python’s four built-in data types for storing data collections; the other three are List, Set, and Dictionary, each having its own set of properties and applications. A tuple is an ordered and immutable collection of items.