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

PythonServer Side ProgrammingProgramming

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 11:22:49