May 2017
Intermediate to advanced
280 pages
6h 2m
English
The syntax for the list () method is given as follows:
list(tuple)
The list function converts the sequence into a list. Let's see the following example:
>>> tup1 = ("a","b","c")>>> list (tup1)['a', 'b', 'c']>>> name = "mohit raj">>> list1(name)>>> list(name)['m', 'o', 'h', 'i', 't', ' ', 'r', 'a', 'j']>>>
You can see that the tuple, tup1, and string name have been converted into a list.
Python offers you a function to sort the list, called sorted ().
Read now
Unlock full access