Question: PURPOSE: Write a function named sumeven which takes two integer parameters named m and n. You may assumes that m n. The function will return

 PURPOSE: Write a function named sumeven which takes two integer parameters

PURPOSE: Write a function named sumeven which takes two integer parameters named m and n. You may assumes that m n. The function will return the sum of all the even integers at least m and less than n. Use the given main function to test your function Hints: You will need to determine if m is an even number or an odd number. This can be accomplished using an if statement with the condition m % 2-0. If that condition is true, then m is even, otherwise m is odd. Use the above logic to adjust the value of m so that it is even. Use a for loop with the appropriate range function to generate the desired sequence of even numbers once you know that m is even. Look at lecture slides to find examples of adding a group of numbers together. # Put the sumeven function after this comment def main): # Get the inputs from the user mint(input ( 'Enter value for m: )) n-int(input ( 'Enter value for n: )) # Make sure m is less than or equal to n, if not then switch them if m> n: m, n n, # Calculate the sum of even numb res sum = sumeven (min) # Show the results print("The sum of the even numbers between %d and %d%(men), endw--') print('is %d'%sum)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!