Python Programming | python question of book store | class and object | oops | tcs ipa questions
35 marks tcs ipa python question
question:
Create a class Book with below attributes:
int - pages, int - price, String - author, int - id, String - title
Create the __init__ method which takes all parameters in the above sequence.
The method should set the value of attributes to parameter values inside the method.
Create a class BookStore with below attributes:
String - bookStoreName, List - BookList
Create the __init__ method which takes all parameters in the above sequence.
The method should set the value of attributes to parameter values inside the method.
Implement two methods -
findMinimumBookByid and
sortBookByid in BookStore class.
1) findMinimumBookByid
Create a method findMinimumBookByid in the BookStore class. This method will return the Book having the minimum value for id of all the Books in the Book List of the BookStore class. If there is no Book found in the Book List or list is empty then return None to main program.
2) sortBookByid
Create a method sortBookByid in the BookStore class. This method will return the sorted list of ids in ascending order of all the Books in the BookList of the BookStore class. If there is no Book found in the Book List, then return None to main program.
These methods should be called from the main method.
Instructions to write main section of the code:
a. You would require to write the main section completely, hence please follow the below
instructions for the same.
b. You would require to write the main program which is inline to the sample input description section mentioned below and to read the data in the same sequence.
c. To create BookStore and Book objects , take the inputs in below sequence.
To create a List of n Book objects read the value of n.
To create a List of n Book objects read values for pages, price, author, id, title
(in this order) and create the Book object and add to the List. Repeat this step n times.
Create the BookStore object passing the bookStoreName and the List of Books created in previous step.
d. Call the method findMinimumBookByid using the BookStore object created in point #c.
e. Call the method sortBookByid using the BookStore object created in point #c.
f. Print the output of both methods as per given sample output.
g. If there is NONE returned from any method print-No Data Found.Don't use any static text or formatting for printing the result. Just invoke the method and print the result. Sequence for specific object will follow same attribute sequence as mentioned in the question.
input and output:
Sample Input:
5
47
247
MJ Demarco
19
The Millionaire Fastlane
61
877
James Clear
81
Atomic Habits
90
31
David Goggins
45
Can't Hurt Me
24
620
Yuval Noah Harari
8
Sapiens
54
163
Stephen Pressfield
97
The War of Art
Sample Output:
24
620
Yuval Noah Harari
8
Sapiens
8
19
45
81
97
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Programming | python question of book store | class and object | oops | tcs ipa questions», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.