Question: Using Python 3.6 Create one program file, with three different functions: main(), evenNums(), and oddNums(). The functions should have two parameters (starting and stopping values).
Using Python 3.6
Create one program file, with three different functions: main(), evenNums(), and oddNums(). The functions should have two parameters (starting and stopping values).
Then in the functions use a for loop with the starting value, and stopping value (inclusive which means both values should be included). Use the same starting and stopping values on both functions.
One function (evenNums), sums up all the even numbers, and returns the sum of the even numbers.
The second function (oddNums) sums up all the odd numbers, and returns the sum of the odd numbers.
Then write a main function that asks the user for the two values (starting and stopping values). The main() then calls both functions and prints the results.
For example, you would print from the main function:
"The sum of all the odd values is: ."
"The sum of all the even values is: ."
Then ask the user in main() if they want to do this again.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
