Computers and Technology
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

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, ed72018373
Which law requires employers to provide safe working environments for their employees? a. civil rights act b. fair labor standards act c. occupational safety and health act d. wagner act
Answers: 1
image
Computers and Technology, 22.06.2019 13:30, ashleypere99
Jane’s team is using the v-shaped model for their project. during the high-level design phase of the project, testers perform integration testing. what is the purpose of an integration test plan in the v-model of development? a. checks if the team has gathered all the requirements b. checks how the product interacts with external systems c. checks the flow of data in internal modules d. checks how the product works from the client side
Answers: 1
image
Computers and Technology, 22.06.2019 21:30, Tcareyoliver
The salespeople at hyperactive media sales all use laptop computers so they can take data with them on the road. you are a salesperson for superduper lightspeed computers talking to hyperactive media sales about upgrading the laptops to windows 10. explain how network location awareness in windows 10 would make the laptops more secure.
Answers: 3
image
Computers and Technology, 23.06.2019 23:30, jamalchris9353
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
Do you know the correct answer?
Can someone improve it a bit more and create a class for Dish as well. So different dishes are repre...

Questions in other subjects: