Question: Write a Python program using Python 3.6.2. The program should be saved as a text file with the extention '.py'. Problem 1a. Write a function
Write a Python program using Python 3.6.2. The program should be saved as a text file with the extention '.py'.
Problem 1a.
Write a function named hasFinalLetter that takes two parameters:
1. strList, a list of non-empty strings
2. letters, a string of upper and/or lower case letters
The function hasFinalLetter should create and return a list of all the strings in strList that end with a letter in letters.
For example, hasFinalLetter if called with arguments [Hello worlD, hotel, Howdy] and yD should return [Hello WorlD, Howdy].
Problem 1b.
Create three test cases, each consisting of a list of non-empty strings and a string of upper and/or lower case letters, for your function in Problem 1a. One of these tests should return the empty list. For each test case write two assignment statements and a function call that pass the test arguments to your function.
Problem 2a.
Write a function named isDivisible that takes two parameters:
1. maxInt, an integer
2. twoInts, a tuple of two integers
The function isDivisible should create and return a list of all the ints in the range from 0 to maxInt (not including maxInt) that are divisible by both ints in twoInts.
For example isDivisible if called with arguments 36 and (3, 5) should return [0, 15, 30].
Problem 2b.
Create three test cases, each consisting of a value for maxInt and a value for twoInts, for your function in Problem 2a. One of these tests should return the empty list. For each test case write two assignment statements and a function call that pass the test arguments to your function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
