generated from Code-Institute-Org/python-essentials-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpizzas.py
82 lines (66 loc) · 1.8 KB
/
pizzas.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
class Pizza:
"""
Creates an instance of pizza
"""
def __init__(self, name, dough, sauce, toppings, price):
self.name = name
self.dough = dough
self.sauce = sauce
self.toppings = toppings
self.price = price
def description(self):
name = self.name.capitalize()
ingredients = ""
if self.dough != "":
ingredients += f"{self.dough.capitalize()} dough"
if self.sauce != "":
ingredients += f", {self.sauce.capitalize()} sauce"
if len(self.toppings) != 0:
for item in self.toppings:
ingredients += f", {item.capitalize()}"
if ingredients != "":
ingredients = f"({ingredients})"
return f"{name} {ingredients}"
def ingredients(self):
ingredients = ""
if self.dough != "":
ingredients += f"{self.dough.capitalize()} dough"
if self.sauce != "":
ingredients += f", {self.sauce.capitalize()} sauce"
if len(self.toppings) != 0:
for item in self.toppings:
ingredients += f", {item.capitalize()}"
if ingredients == "":
ingredients = f"Choose your own (max 4 toppings)"
return f"{ingredients}"
margherita = Pizza(
"margerita",
"white",
"tomato",
["mozzarella", "basil"],
8.00)
vegan = Pizza(
"vegan",
"wholegrain",
"tomato",
["vegan cheese", "jackfruit"],
10.00)
spicy = Pizza(
"spicy",
"white",
"bbq",
["mozzarella", "pepperoni"],
10.00)
truffle = Pizza(
"truffle",
"white",
"tomato",
["scamorza", "mushrooms", "black truffle"],
12.00)
custom = Pizza(
"make your own",
"",
"",
[],
"8.0*")
pizza_menu = [margherita, vegan, spicy, truffle, custom]