Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started