Question: All development will be in this directory. Part 1 - Functions and Exceptions 1. Create a new python file called assignment1_part1.py. All code for this
All development will be in this directory. Part 1 - Functions and Exceptions 1. Create a new python file called assignment1_part1.py. All code for this part should be in this file and eventually pushed to Github. 2. Create a function named listDivide that takes in two parameters. One parameter is a list called numbers. The second parameter is an integer called divide. The divide parameter should have a default value of 2. The function returns the number of elements in the numbers list that are divisible by divide. 3. Create a custom exception class called 'ListDivide Exception'. This should be two lines of Python code. 4. Write another function called testList Divide that performs the following tests on listDivide: a. listDivide([1,2,3,4,5]) should return 2 b. listDivide([2,4,6,8,10]) should return 5 C. listDivide([30, 54, 63,98, 100), divide=10) should return 2 d. listDivide() should return 0 e. listDivide([1,2,3,4,5), 1) should return 5 The function testListDivide does not return anything. However, if any of the tests fail the function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
