Write the function definition for a function which accepts 2 values from the main program and returns the average of the two numbers. DO NOT WRITE AN ENTIRE PROGRAM. DO NOT WRITE THE STATEMENT THAT CALLS THE FUNCTION! JUST WRITE THE FUNCTION DEFINITION
Python code:
#defining average function which accepts two numbers num1 and
num2
def average(num1,num2):
#returning the average of two numbers
passsed
return((num1+num2)/2)
#lines 6,7,8 are not required, the calling is done only for your
understanding
#calling average function and printing the result for a sample
value
print(average(2,4))
Screenshot:
Output:
Get Answers For Free
Most questions answered within 1 hours.