-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathShoes.py
More file actions
25 lines (20 loc) · 848 Bytes
/
Shoes.py
File metadata and controls
25 lines (20 loc) · 848 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
class Shoes:
def __init__(self, name, price) -> None:
self.name = name
self.price = price
def budget_check(self, budget):
if not isinstance(budget, (int, float)):
print("Invalid entry. Please enter a number.")
exit()
def change(self, budget):
return (budget - self.price)
def buy(self, budget):
self.budget_check(budget)
if budget>= self.price:
print(f"You can cop some {self.name}")
if budget == self.price:
print("You have exactly enough money for these shoes.")
else:
print(f"You can buy these shoes and have ${self.change(budget)} left over.")
exit("Thanks for using our shoe budget app!")
# print(f"You don't have enough budget for {self.name}.")