Book Thick Check
Programming Interview
Easy
8 views
Problem Description
Title (no spaces) and pages are provided. Create Book class with method thick() that returns YES if pages>300 else NO.
Input Format
One line: title pages.
Official Solution
import sys
p=sys.stdin.read().strip().split()
if len(p)<2: sys.exit(0)
t=p[0]
pages=int(p[1])
class Book:
def __init__(self,title,pages):
self.title=title
self.pages=pages
def thick(self):
return 'YES' if self.pages>300 else 'NO'
print(Book(t,pages).thick())
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!