Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
oops1.py
#python 3.5.2 #oops in python class Human: def __init__(self,name,age):#this method is used to create/define varibles in an object self.name=name self.age=age print('name: ',self.name) print('age: ',self.age) def details(self): print('name: ',self.name) print('age: ',self.age) h1=Human('Ashu',23)#Constructor (Human()) calls __init__() method implicitly at the time of object creation to initilize the object h2=Human('Ranjan',45) Human.details(h1) h2.details() print(h1.name)
run
|
edit
|
history
|
help
0
Linear Regression Python
we
Code
15
Pytest
sensi
Payth
JV
Ej2_python_204676887
PyRef