Q&A CBSE12D-2015-B02C #6525
Question:
Write a class PICTURE in Python with following specifications: Instance Attributes
- Category # String value
- Location # Exhibition Location with String value
Methods:
- FixLocation() # A method to assign Exhibition
# Location as per Category as
# shown in the following table
| Category | Location |
| Classic | Amina |
| Modern | Jim Plaq |
| Antique | Ustad Khan |
– Enter() # A function to allow user to enter values # Pno, Category and call FixLocation() method – SeeAll() # A function to display all the data members
Answer:
class PICTURE:
Pno=0
Category=" "
Location=" "
def FixLocation():
if self.Category=="Classic":
self.Location="Amina"
elif self.Category=="Modern":
elf.Location="Jim Plaq"
elif self.Category=="Antique":
self.Location="Ustad Khan"
def Enter():
self.Pno=int(input("Enter Pno:"))
self.Category=input("Enter Name:")
self.FixLocation()
def SeeAll()
print self.Pno,self.Category,self.Location
