Question: 5. Write a Python function named pattern that accepts two arguments (an integer and a string) and prints the character to form a triangular shape,

 5. Write a Python function named "pattern" that accepts two arguments

5. Write a Python function named "pattern" that accepts two arguments (an integer and a string) and prints the character to form a triangular shape, as shown below: For example, pattern (8,"ABC ") produces: BCABCABCBABCABABCCABABCBCABCABC 6. Define a class named Book that keeps track of book objects such that the instance data contains the book's title, author (protected member), year (private mamber) and a unique identification number, say id that starts form 1 for the first book object and is incremented by 1 each time a new book with at least the title specified is created. The required methods in the Book class are as follows: (i) At least the title should be defined for each object. The properties author and year may be initialized as "Unknown" and 0 respectively. (ii) there are setter (set_year) and getter (get_year) methods for the year property. (ii) a setter (set_author) method for the author property. 7. Use the class defined in question 6 for the followings: (i) Create a list of 8 objects by using the class defined in question 6 . Design your code to use all methods explained. (ii) Write a code to display the list of books. Each book should be on a new line with the following order: id, author, title,year (iii) Create a list of author names (at least 5 names) and write a loop to display the book names of each author if that author has any book 8. Define an abstract class named animal that has properties of name, brand and num_of_legs. This class has an abstract class named motion. Then define the following child classes: (i) A bird class where the motion method displays " "name" can fly"; (ii) A dog class where the motion method displays " "name" can run"; (iii) define a fish class where the motion method displays " "name" can swim

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