You can skip this section and come back to this after you have studied the chapter on tuples.
You can type cast a sequence of elements to a list using the list()
function. The code below turns a tuple into a list.
t1 = ( "apple", "banana", "cherry" )
print( t1 )
print( type( t1 ) )
fruitlist = list( t1 )
print( fruitlist )
print( type( fruitlist ) )
You can turn a string into a list of its characters by using a list casting on the string.