![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 11.05.2021 21:40 mari8493
Can someone improve it a bit more and create a class for Dish as well. So different dishes are represented as objects of that class. It would be greatly appreciated.
class Food(object):
def __init__(self, name, price):
self. name = name
self. price = price
def getprice(self):
return self. price
def __str__(self):
return self. name + ' : ' + str(self. getprice())
def buildmenu(names, costs):
menu = []
for i in range(len(names)):
menu. append(Food(names[i], costs[i]))
return menu
names = ['Coffee', 'Tea', 'Pizza', 'Burger', 'Fries', 'Apple', 'Donut', 'Cake']
costs = [250, 150, 180, 70, 65, 55, 120, 350]
Foods = buildmenu(names, costs)
n = 1
for el in Foods:
print(n,'. ', el)
n = n + 1
![ansver](/tpl/images/cats/User.png)
Answers: 3
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 16:10
When copying and pasting text, the first step is move your cursor type the text select the copy command select the paste command
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 00:50
Representa os dados de um banco de dados como uma coleç? o de tabelas constituídas por um conjunto de atributos, que definem as propriedades ou características relevantes da entidade que representam. marque a alternativa que representa o modelo descrito no enunciado. escolha uma:
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 12:00
From excel to powerpoint, you can copy and paste a. cell ranges and charts, one at a time. b. cell ranges and charts, simultaneously. c. charts only. d. cell ranges only.
Answers: 3
You know the right answer?
Can someone improve it a bit more and create a class for Dish as well. So different dishes are repre...
Questions
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 23.09.2021 14:00
![question](/tpl/images/cats/himiya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 23.09.2021 14:00
![question](/tpl/images/cats/mat.png)
Mathematics, 23.09.2021 14:00
![question](/tpl/images/cats/mat.png)
Mathematics, 23.09.2021 14:00
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 23.09.2021 14:00
![question](/tpl/images/cats/geografiya.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 23.09.2021 14:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/fizika.png)
Physics, 23.09.2021 14:00
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 23.09.2021 14:00
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 23.09.2021 14:00
![question](/tpl/images/cats/himiya.png)
Chemistry, 23.09.2021 14:00
![question](/tpl/images/cats/health.png)
Health, 23.09.2021 14:00
![question](/tpl/images/cats/mat.png)