Question: The main function below must be written in the program and used for the variables in part (a): def main(): # define the variables needed

The main function below must be written in the program and used for the variables in part (a):
def main(): # define the variables needed to test the required functions myvals = [-1, 6, 2, -3, 5, 5, 3, -5, 2, 5, 3, 3, 10, 5] mymatrix1 = [[50, 3.7, -7, 4], [-8, 9, 310, -1.8], [-120, 7.9, 3.2, 13]]
mymatrix2 = [[19, 3.7, -7], [-8, 9, -1.8], [7.9, 3.2, -11], [4.3, -0.32, 4]] p1 = [3, 1, -2, -8] p2 = [2, 1.4, 1, -1, 2] x1 = 2.9 x2 = -3.4 # for part a) ans1 = ArraySumEven(myvals) ans2 = ArraySumEven(p1) print('part a) ', ans1, ans2) print() # print a blank line main()
THE PRINTED ANSWERS ARE:
part a) 20, -10
Write a single Python program (.py) file that fulfills all of the requirements given below. You will upload that single Python file to the Canvas Homework 1 Assignment Dropbox. You will name that file: Firstname_Lastname_CWID.py, using your actual name and student ID (CWID). The description below requires that you write four different functions that perform four unrelated tasks. All four functions and the function named main(), used to call and test the four functions, must be placed in that single Python file. You will test your functions using the particular numerical values (integers, floats or arrays) given in the main() function below. You must use comments in your functions, to describe the purpose of your lines of code a) Write a function defined as: def ArraySumEven(vals): vals: an array (list) containing integers or floats return value: the sum of all the even values in the array. Negative values can be even. Note: Use Google to learn how to detect Even or Odd in python
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
