List to Tuple Conversion in Python

List to tuple 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.

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.

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.

Print Statement in Python Program

The print() function sends a message to the screen or another standard output device. The message can be a string or another object, which will be converted to a string before being displayed on the screen. The print statement is used to deliver output to your computer’s standard output unit, which is normally your display or, in certain cases, your printer. 

To get the output and debug the code in Python, use the print() function. The supplied message or value is displayed on the console using this function. A string or any other object can be used as the message. Using this program we can execute list to tuple in python.

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)