#Write a function sum that has two parameters, a and b, and function finds and #returns the sum of the parameters #Write main to test your function #function definition def sum(a,b): #sum is a name of the function; a and b are formal parameters total=a+b return total def main(): #Testing function sum #Test 1: we will call the function with actual parameters 5 and 7 function_result=sum(5,7) #this line will first call function sum replacing a with 5 and b with 7 #then function sum will be executed, total=5+7=12 #then function sum will return 12 to the main function and the value 12 #will be assigned to variable function_result print("Function use Example 1:", function_result) #Test 2: we will first read two integers (user input) #then call function sum to find the sum of inputs #we can use the same variable names for actual and formal parameters a=int(input("enter first integer ")) b=int(input("enter second integer ")) #these a and b are NOT the same a and b we used in function definition #these a and b have "last name" main #and in function sum they had "last name" sum function_result1=sum(a,b) print("Function use Example 2:", function_result1) #Test 3: we will first read two integers (user input) #then call function sum to find the sum of inputs #This time we will use different variable names for actual parameters #we will call the function inside print statement num1=int(input("enter num1 ")) num2=int(input("enter num2 ")) print("Function use Example 3:", sum(num1, num2)) #Test 4: we will first read two floats (user input) #then call function sum to find the sum of inputs a=float(input("enter float ")) b=float(input("enter float ")) function_result2=sum(a,b) print("Function use Example 4:", function_result2) #Test 5: we will first read two strings (user input) #then call function sum to find the sum of inputs but in this case it #will be a string constructed from first and second input name1=input("enter first string ") name2=input("enter second string ") print("Function use Example 5:", sum(name1, name2)) main()