# A Python program returning multiple values from a method using list
# Defining a function which returns a list
str = "Demo"
x = 20
return [str, x];
# Driver code to test above function
list = fun() //calling of fun()
print(list) // printing list returned from function
Explanation of above program:
A list can be defined as comma-separated values (items) between square brackets or simply an array of items in square bracket. The difference between array and list is list can store values of different data types. Lists are immutable i.e values of lists can be updated via indexes or values can be deleted. In above program,a function is defined in which a string and an integer value is defined. The fun() is returning comma-separated values (items) between square brackets whisch is a list. When fun() is called it's return value is assigned to a list variable, finally printing the list.