Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im having trouble with gettin this code to run in python, can anyone help? def main(): author = input('Enter author: ') title = input('Enter title:

Im having trouble with gettin this code to run in python, can anyone help?

def main(): author = input('Enter author: ') title = input('Enter title: ') num_pages = int(input('Enter number of pages: ')) b = Book(author, title, num_pages) print(' ') b.printAuthor() b.printTitle() b.printNumPages() author = input('Enter updated author name: ') title = input('Enter updated title: ') num_pages = int(input('Enter updated number of pages: ')) b.setAuthor(author) b.setTitle(title) b.setNumPages(num_pages) print(' ') b.printAuthor() b.printTitle() b.printNumPages()

main()

class Book:

pass

def __init__(self, author, title, num_pages): self.author = author self.title = title self.num_pages = num_pages

def setAuthor(self, author): self.author = author

def setTitle(self, title): self.title = title

def setNumPages(self, num_pages): self.num_pages = num_pages

def printAuthor(self): print('Author: ' + self.author)

def printTitle(self): print('Title: ' + self.title)

def printNumPages(self): print('Number of pages: ' + str(self.num_pages)

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

Database And Expert Systems Applications 15th International Conference Dexa 2004 Zaragoza Spain August 30 September 3 2004 Proceedings Lncs 3180

Authors: Fernando Galindo ,Makoto Takizawa ,Roland Traunmuller

2004th Edition

3540229361, 978-3540229360

More Books

Students also viewed these Databases questions