Let's say I have a Patron class that has the instance variables: name, patron_id and borroweds(borrowed books). This pretty much is a class for a virtual library. if one of my functions requires me to take a book_id # which is a string and to "reshelve" this book. How would I add the string to my class? This is what I have:
class Patron:
name= ""
patron_id= ""
borroweds= list()
# the class constructor
def __init__(self, name, patron_id, borroweds):
self.name= name
self.patron_id= patron_id
self.borroweds= borroweds
def __str__(self):
s= str("Patron("+str(self.name)+","+str(self.patron_id)+","
+list(self.borroweds)")"
return s
def __repr__(self):
return str(self)
def return_book(self,library,book, book_id):
print("Can you please reshelve this book?" + book_id)
The last function is what I need some help with.