Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: A: Write a program even1.py with a function printEven with heading: def printEven(nums): '''Given a list of integers nums, print the even ones. >>>

Python:

A: Write a program even1.py with a function printEven with heading:

def printEven(nums): '''Given a list of integers nums,  print the even ones.  >>> printEven([4, 1, 3, 2, 7])  4  2  ''' 

In your main program, test the function, calling it several times with different lists of integers. Hint: A number is even if its remainder, when dividing by 2, is 0.

B:

Write a program even2.py with a function chooseEven with heading:

def chooseEven(nums): '''Given a list of integers, nums,  return a list containing only the even ones.  >>> chooseEven([4, 1, 3, 2, 7])  [4, 2]  ''' 

In your main program, test the function, calling it several times with different lists of integers and printing the results. Hint: Create a new list, and append the appropriate numbers to it.

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

Explain Coulomb's law with an example

Answered: 1 week ago

Question

What is operating system?

Answered: 1 week ago

Question

What is Ohm's law and also tell about Snell's law?

Answered: 1 week ago

Question

Developing and delivering learning that is integrated with the job.

Answered: 1 week ago