Question: Create a new python file called assignment 1 _ part 1 . py . All code for this part should be in this file and

Create a new python file called assignment1_part1.py. All code for this part should be in this file and eventually pushed to Github.
Create a function named list_divide 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.
Create a custom exception class called ListDivideException. This should be two lines of Python code.
Write another function called test_list_divide that performs the following tests on list_divide:
list_divide([1,2,3,4,5]) should return 2list_divide([2,4,6,8,10]) should return 5list_divide([30,54,63,98,100], divide=10) should return 2list_divide([]) should return 0list_divide([1,2,3,4,5],1) should return 5
The function test_list_divide does not return anything. However, if any of the tests fail, the function should raise the ListDivideException.
When your script runs, it should call test_list_divide. Ideally, if your list_divide and test_list_divide functions are written properly, no exception should be raised. If the exception is raised however, try to figure out what is wrong. Keep updating the code until you know listDivide is working properly.
Once this is completed, run a git status command. This should indicate to you that there is a file called assignment1_part1.py that is not in the repository yet. Run the correct git command to add this file to the repository.
Once that is done, commit this change (to the default master) using git commit.
Push this commit to the origin using git push, which is Github in this case.
Part 2 Simple Class
Create a new python file called assignment1_part2.py. All code for this part should be in this file and eventually pushed to Github.
Create a class called Book. The class should have the following properties:
Two attributes, author and title, both of which should be initialized to the blank stringAn __init__ function that takes in an author and a title, and sets them to the object variablesA function called display(), which when called, simply prints out a string representing the book. The output should be in the form of title, written by author. Example: Of Mice and Men, written by John Steinbeck.
Instantiate two objects from this class. The first object represents the book Harry Potter and the Goblet of Fire, written by J. K. Rowling the other is Ivanhoe: A Romance by Walter Scott.
Print both of these objects to the screen by calling their display() functions

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 Programming Questions!