Q&A CBSE12A-2015-B02C #6355
Question:
Write a class PHOTO in Python with following specifications:
Instance Attributes
-Pno # Numeric value
-Category # String value
-Exhibit # Exhibition Gallery with String value
Methods:
-FixExhibit() # A method to assign Exhibition
# Gallery as per Category as
# shown in the following table
| Category | Exhibit |
| Antique | Zaveri |
| Modern | Johnsen |
| Classic | Terenida |
Register() # A function to allow user
# to enter values of Pno, Category
# and call FixExhibit() method
ViewAll{) # A function to display all the data
# members
Answer:
class PHOTO:
Pno=0
Category=" "
Exhibit=" "
def FixExhibit():
if self.Category=="Antique":
self.Exhibit="Zaveri"
elif self.Category=="Modern":
self.Exhibit="Johnsen"
elif self.Category=="Classic":
self.Exhibit="Terenida"
def Register():
self.Pno=int(input("Enter Pno:"))
self.Category=input("Enter Name:")
self.FixExhibit()
def ViewAll()
print self.Pno,self.Category,self.Exhibit
