How to create a tuple from a string and a list of strings in Python?


The built-in function tuple() converts a Python string into tuple of individual characters. It also turns a list object into a tuple.

>>> tuple("TutorialsPoint")
('T', 'u', 't', 'o', 'r', 'i', 'a', 'l', 's', 'P', 'o', 'i', 'n', 't')
>>> L1=[45, 32, 100, 10, 24, 56]
>>> tuple(L1)
(45, 32, 100, 10, 24, 56)


Updated on: 20-Feb-2020

115 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements