0

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 ?

JRodDynamite
  • 12,325
  • 5
  • 43
  • 63

1 Answers1

1

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.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358