Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!