Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON Question 5: Write a Python program which does the following: O The program includes three functions (but you do not need to call these

PYTHON

image text in transcribed

Question 5: Write a Python program which does the following: O The program includes three functions (but you do not need to call these functions) The program includes a function called buildList(number) that uses a for in range structure and the .append method to permit the user to call the function, and include as many integer elements in the list (with the parameter number) as the user chooses (e.g., [4, 7, 15, -4, 10, 7 17, 12, 9, 15]) The program includes a second function, countEvens(alist) with a for loop (either for in... or for in range... ), which returns the number of even integers in the list. Note the following code, which uses the mod or remainder operator (%) to identify even integers in a list: if alist[index] % 2 0: evenIntegers = evenIntegers + 1 The program includes a third function match(alist) with a for loop (either for in... or for in range... ) that returns the number of elements in the list that match the first element in the list. (For example, in the list [7, 4, 10, 7, 5, -2, 6, 7, 9, 7], the first element is 7, and three subsequent elements match this first, so the function would return the integer value 3). Precede each function definition with a comment, explaining briefly what the function does. Add additional comments to the program as you find appropriate (this bullet ungraded). ==

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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

=+ For what reasons can and do unions go on strike?

Answered: 1 week ago

Question

=+ Is secondary industrial action common and/or legal?

Answered: 1 week ago

Question

=+What sanctions are available to employers

Answered: 1 week ago