-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCipeleiporez.py
More file actions
35 lines (29 loc) · 796 Bytes
/
Copy pathCipeleiporez.py
File metadata and controls
35 lines (29 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import abc
class Product(abc.ABC):
def __init__(self,name,price):
self.name=name
self.price=price
@abc.abstractmethod
def tax(self):
pass
def buy(self):
print("You bought a product",self.name,"with a price",self.tax(),"dollars")
class Shoes(Product):
def tax(self):
return self.price*1.2
p=Shoes("Nike Airmax",100)
p.buy()
class Product(abc.ABC):
def __init__(self,name,price):
self.name=name
self.price=price
@abc.abstractmethod
def tax(self):
pass
def buy(self):
print("You bought a product",self.name,"with a price",self.tax(),"dollars")
class Shoes(Product):
def tax(self):
return self.price*1.2
p=Shoes("Nike Airmax",100)
p.buy()