May 2017
Intermediate to advanced
280 pages
6h 2m
English
Sometimes, it may be necessary to return any specific datatype or value from a function which takes any arbitrary number of arguments. Let's evaluate this scenario with an example:
def sum(a, b): c = a+b return cx = 10 y = 50 print "Result of addition ", sum(x,y)
Here, we define the function, which accepts two arguments and the body evaluates their sum with return type as value of the sum, which is denoted by the return c statement. We then call the function in the print statement and pass the value of variable x and variable y. This will give us the output as shown next:

Read now
Unlock full access