Sponsor Area
Exception Handling & Generate Functions
Question
Write Addnew(Book) and Remove(Book) methods in Python to Add a new Book and Remove a Book from a List of Books, considering them to act as PUSH and POP operations of the data structure Stack.
Solution
class stack:
Book=[]
def Addnew(self):
Name=input('Enter Book Name :')
stack.Book.append(Name)
def Remove(self):
if (stack.Book==[]):
print 'Stack Empty'
else:
print 'Deleted Book is : ',stack.Book.pop()
Some More Questions From Exception Handling & Generate Functions Chapter
Observe the following table carefully and write the names of the most appropriate columns, which can be considered as (i) candidate keys and (ii) primary key.
Id
Product
Qty
Product
Transaction Date
101
Plastic Folder 12'
100
3400
2014-12-14
104
Pen Stand Standard
200
4500
2015-01-31
105
Stapler Medium
250
1200
2015-02-28
109
Punching Machine Big
200
1400
2015-03-12
103
Stapler Mini
100
1500
2015-02-02
Sponsor Area
Mock Test Series
Mock Test Series



