What is the Different between return a list and a tuple in python ? for example:
def func1(a,b):
return a,b
def func2(a,b):
return [a,b]
When I can use func1 and when I can use func2 ?
What is the Different between return a list and a tuple in python ? for example:
def func1(a,b):
return a,b
def func2(a,b):
return [a,b]
When I can use func1 and when I can use func2 ?
One return value will be a list and the other will be a tuple. You can use either whenever you like provided you understand what it means to use a list instead of a tuple and vice versa.