Write a python PushOn(book) and pop(book) method/function to add a new book and to delete a book from a list of book titles. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a python PushOn(book) and pop(book) method/function to add a new book and to delete a book from a list of book titles.

Can you solve this and before explain what the question means

15th Sep 2020, 5:23 AM
Abhijit
Abhijit - avatar
6 Answers
15th Sep 2020, 5:49 AM
Oma Falk
Oma Falk - avatar
+ 2
Probably....... thanks for helping
15th Sep 2020, 5:36 AM
Abhijit
Abhijit - avatar
+ 1
It means you have a list of books lets say books =['book1', 'book2', 'book3'] You have to write a function PushOn(book) which will add a book to this list, so if you call it like this PushOn('book4'), book4 should be added to list books, Also pop(book) for example, if you call it like this pop('book3') it will remove book3 from the list.. Give it a try 😀
15th Sep 2020, 5:32 AM
Ruba Kh
Ruba Kh - avatar
+ 1
Even I thought the same but I am confused whether we should put it in a class or define just functions
15th Sep 2020, 5:34 AM
Abhijit
Abhijit - avatar
+ 1
I think the question need only functions
15th Sep 2020, 5:34 AM
Ruba Kh
Ruba Kh - avatar
+ 1
Thank you so much
15th Sep 2020, 5:54 AM
Abhijit
Abhijit - avatar