B02C-2015D – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12D-2015-B02C #PYTHON#6525    siteicon   siteicon  

Problem Statement - B02C-2015D

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

Solution

TC++ #6525

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


Share

CSKC| Created: 14-Jan-2019 | Updated: 14-Jan-2019|CBSE12D-2015









Back