scientific_comp_projects/CODE/[python]object_oriented(tech_with_tim)/animals.py

19 lines
253 B
Python
Raw Normal View History

2021-10-29 15:16:40 +02:00
class Dog:
def __init__(self,name):
self.name = name
print(name)
def add_one(self,x):
return x+1
def bark(self):
print("bark")
d = Dog('Tim')
d2 = Dog('Billy')
d.bark()
print(d.add_one(5))
print(type(d))