I was trying out stuff in order to try using classes and i came up with this code to remember orders from tables. But I got into a pickle trying to put too many variables inside a definition, and asked myself if it was even possible to have a variable as a suffix (so as a 'randomname'.variable)
class Nourriture:
def __init__(self, entree, meal, dessert):
self.entree = entree
self.meal = meal
self.dessert = dessert
John = Nourriture('poire à l\'anglaise','foie gras et entrecôte', 'creme brulée')
Marty = Nourriture('poire à la francaise','foie maigre et entrejambe', 'creme brulée')
Marie = Nourriture('rien','rien','rien')
Camille = Nourriture('rien','rien','crepe')
Tables = {
'table1' : [John, Marty, Marie],
'table2' : [Camille]
}
def repasorder (plat, tablenumber):
return [Tables[tablenumber][i].plat for i in Tables[tablenumber]]
print(repasorder('meal','table1'))
(sorry some bits are in french)
I wanted to know how i could make this whole code work, I am aware there might be other problems in my code but I am pretty much stuck.
A bit of help is welcomed :D