class Library:
def __init__(self):
self.bookname=""
self.author=""
def getdata(self):
self.bookname=input("Enter Name of the Book : ")
self.author = input("Enter Author of the Book: ")
def display(self):
print("Name of the Book: ",self.bookname)
print("Author of the Book: ",self.author)
print("\n")
book=[]
ch='y'
while(ch=='y'):
print("1.Add New Book \n2.Display Books")
resp = int(input("Enter your choice : "))
if(resp==1):
L=Library()
L.getdata()
book.append(L)
elif(resp==2):
for x in book:
x.display()
else:
print("Oopsie, That's an invalid input")
ch = input("Would you like to continue?")
Hey, In the above program, when I enter my option as 1 it gives an error as Library is not defined. Is there anything wrong in the program? If anyone knows pls help out.
Answers
Answered by
0
Answer:
idk
Explanation:
Similar questions