/ Python And R Data science skills: 06 instance attributes in Telugu

Saturday, 17 February 2018

06 instance attributes in Telugu

06 instance attributes
In [1]:
class Emp:
    name ="venkat"
    jobtitle="Sales person"
    sales=3
    def achive (self):
        if(self.sales>8):
            print("Achived")
        else:
            print("fail")
In [5]:
emp1=Emp()
emp2=Emp()
In [3]:
emp1.name
Out[3]:
'venkat'
In [6]:
emp2.name
Out[6]:
'venkat'
In [7]:
emp2.sales
Out[7]:
3
In [8]:
Emp.sales=20
In [9]:
emp2.sales
Out[9]:
20
In [13]:
emp1.sales
Out[13]:
20
In [11]:
emp2.sales=15
In [12]:
emp2.sales
Out[12]:
15

No comments:

Post a Comment