Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help on this assignment using Python 3.6 Basic Programming Competence: Use Python This quiz is very short and straight forward. When I have a

Need help on this assignment using Python 3.6

Basic Programming Competence: Use Python

This quiz is very short and straight forward. When I have a student that wants to challenge the CSC 110 prerequisite for CSC 142, I ask them to write a simple program for me. I consider this request something that can be easily completed by someone who successfully completes CSC 110. So, this is a simple "test" to see if you have grok-ed the main points of CSC 110. (Participation points for explaining the verb in the previous sentence. Here "explain" can be define or cite the source, two separate opportunities. Make sure you share.)

Please complete the following program. In the write-up, it talks about "computer programming language of your choice" and "arrays". Of course, you should choose Python as the language. And if you do, Python does not support arrays, so use a list instead.

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 that holds 20 integer values

use a loop to put the integer values 1, 2, 3, ..., 18, 19, 20 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

return the sum of the values.

The end result is that the program prints out the value 100.

Notes:

Use local variables rather than global variables, if supported in the implementation language.

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.

Please make sure that you add the standard header comment to this script.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions