Sponsor Area

NCERT Solutions for Class 12 Help.html Computer Science With Python Chapter 8 Exception Handling & Generate Functions

Exception Handling & Generate Functions Here is the CBSE Help.html Chapter 8 for Class 12 students. Summary and detailed explanation of the lesson, including the definitions of difficult words. All of the exercises and questions and answers from the lesson's back end have been completed. NCERT Solutions for Class 12 Help.html Exception Handling & Generate Functions Chapter 8 NCERT Solutions for Class 12 Help.html Exception Handling & Generate Functions Chapter 8 The following is a summary in Hindi and English for the academic year 2025-26. You can save these solutions to your computer or use the Class 12 Help.html.

Question 1
CBSEENCO12011544

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()

Sponsor Area