A simple way to convert a list to a tuple in Python is this:
tuple1=tuple(list1)
But if the list1 contains one or more lists, they remain the same. Is there a way that we can convert them as well?
E.g.
list1=[1,3,'abc',[3,4,5]]
goes to:
tuple1=(1,3,'abc',(3,4,5))
Recursion is all you need here: