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 assignmentpartpy All code for this part should be in this file and eventually pushed to Github.
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 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 testlistdivide that performs the following tests on listdivide:
listdivide should return listdivide should return listdivide divide should return listdivide should return listdivide should return
The function testlistdivide does not return anything. However, if any of the tests fail, the function should raise the ListDivideException.
When your script runs, it should call testlistdivide. Ideally, if your listdivide and testlistdivide 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 assignmentpartpy 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 Simple Class
Create a new python file called assignmentpartpy 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
