Adding Chapter 3 files

This commit is contained in:
muassif
2021-01-16 15:14:59 +04:00
committed by GitHub
parent abab477fe1
commit d78cf1f8e9
17 changed files with 402 additions and 0 deletions
@@ -0,0 +1,17 @@
#methodoverloading1.py
class Car:
def __init__(self, color, seats):
self.i_color = color
self.i_seat = seats
def print_me(self, i='basic'):
if(i =='basic'):
print(f"This car is of color {self.i_color}")
else:
print(f"This car is of color {self.i_color} with seats {self.i_seat}")
if __name__ == "__main__":
car = Car("blue", 5 )
car.print_me()
car.print_me('blah')
car.print_me('detail')