-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListino.py
More file actions
29 lines (21 loc) · 811 Bytes
/
Listino.py
File metadata and controls
29 lines (21 loc) · 811 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
import json
class Listino:
def __init__(self):
self.listino_prezzi = {}
self.listino_ingredienti = {}
with open('listino.json', 'r') as listino_json:
self.listino_prezzi = json.load(listino_json)
with open('ingredienti.json', 'r') as ingredienti_json:
self.listino_ingredienti = json.load(ingredienti_json)
def get_listino(self):
return self.listino_prezzi
def get_price(self, pizza_name):
if pizza_name in self.listino_prezzi.keys():
return self.listino_prezzi[pizza_name]
else:
return '?.??'
def get_ingrediente(self, pizza_name):
if pizza_name in self.listino_ingredienti.keys():
return self.listino_ingredienti[pizza_name]
else:
return ''