-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.py
More file actions
67 lines (56 loc) · 1.68 KB
/
Copy pathlibrary.py
File metadata and controls
67 lines (56 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#Final Program
#Library class and queu
#Sneha Patel
#Dec 11, 2023
class Library:
def __init__(self,title,author,status,Priority):
self._title = title
self._author = author
self._status= int(status)
self._priority = int(Priority)
@property
def title(self):
return self._title
@title.setter
def title(self,title):
self._title = title
@property
def author(self):
return self._author
@author.setter
def author(self,author):
self._author = author
@property
def status(self):
return self._status
@status.setter
def status(self,status):
self._status= status
@property
def priority(self):
return self._priority
@priority.setter
def priority(self,Priority):
self._priority = int(Priority)
def __str__(self):
return f"{self.author} : {self.title}, {self.status} "
#return f"{self._title}, {self._author}, {self.priority}, {self.status}"
def __lt__(self, other, criterion='author'):
if criterion == 'author':
return self._author < other._author
elif criterion == 'title':
return self._title < other._title
else:
# Default to author if an invalid criterion is provided
return self._title < other._title
class Queue:
def __init__(self):
self.queue = []
def enqueue(self, book):
self.queue.append(book)
#print(f"Book '{book.title}' has been returned and added to the queue.")
def dequeue(self):
if self.queue:
return self.queue.pop(0)
else:
print("Queue is empty.")