Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON DEBUGGING HELP: PLEASE FIX THIS PROBLEM 5: Let's define a subclass of Book called PaperBook. PaperBook should inherit from Book and should add an

PYTHON DEBUGGING HELP: PLEASE FIX THIS

image text in transcribed

PROBLEM 5: Let's define a subclass of Book called PaperBook. PaperBook should inherit from Book and should add an instance variable called numTornPages, which is set to 0 in the constructor Add a method to the PaperBook class (NOT to the Book class) called ripPage , which increases numTornPages by 1 every time it is called In [43]: # define subclass here class PaperBook Book): def init_(self,title, author): self.numTornPages 0 super)._init(self) def ripPage (self): for x in self.numTornPages: self.numTornPages 1 In [44]: # manual test of subclass here last_lecture PaperBook ( 'The Last Lecture', 'Randy Pausch') print(last_lecture) Traceback (most recent call last) RecursionError in () 1 # manual test of subclass here 2 last-lecture PaperBook( 'The Last Lecture' , 'Randy Pausch') --3 print(last lecture) in -str-(self) 10 def str (self): - retur "%s by %s" % (self.title, self.author) 12 13 14 def getTitle(self) last 1 frames repeated, from the frame below ipython-input-1-65609b7b775f> in str (self) i 10 10 def str (self): . return " %s by %s" % (self, title, self.author) > 12 13 14 def getTitle(self): RecursionError: maximum recursion depth exceeded while getting the str of an object

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

Be able to differentiate between arbitration and mediation

Answered: 1 week ago

Question

Understand how arbitrators are credentialed and selected

Answered: 1 week ago

Question

Appreciate the advantages of arbitration

Answered: 1 week ago