Question: Coding in Phython question! Write a simple program in the computer programming language of your choice. The program shall have two functions (methods): a main
Coding in Phython question!
Write a simple program in the computer programming language of your choice. The program shall have two functions (methods): a main function and a helper function.
The main function shall do the following:
* declare an array (list) that can hold 25 integer values
* use a loop to put the integer values 1, 2, 3, ..., 23, 24, 25 into the array
* pass the array to the helper function which will return an integer value
* print out the value returned by the helper function.
The helper function shall do the following:
* traverse the array adding the odd values found in the array parameter
* return the sum of the values.
The whole program should print out the value 169.
Note: If the helper function was passed a five-element array containing {2, 4, 6, 8, 10}, it shall return the value zero (0). If it is passed {1, 3, 5, 7, 9}, it shall return the value 25.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
