In function some times we need to return the value at back to the calling point of the function so that the return value is further used in program , generally in other programming like C language, we only return one value but in python we return number of values.
- for returning the items we have a return
keyword in which we can any type of data like int,float,list,tuple,set,dictionary etc.
#return simple values
print("we return two value")
print("we return the list")
we return two value
we return the list
['one', 'two', 'three']
- In this program, we have a two function func1()
, in func1() function we return 1 and 2 so it store in var which is of tuple data type and func2() return the list of items and it stores in listvar which is type of list data type then we print both the variable to show the results.