def add(x,y,z):
= x+y
i = y+z
j = x+z
k return [i,j,k]
= add(3,4,5)[0] # this gives us i, 7
a = add(3,4,5)[1] # this gives us j, 9
b = add(3,4,5)[2] # this gives us k, 8
c
print(a,b,c)
7 9 8
Venu GVGK
December 28, 2024
A function can return multiple values in a list. Each value can be used at multiple places using the index of the list.
For example,