Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function called dishlist_all_cheap that takes a list of Dishes (note how this is different from dish_is_cheap) and a number and returns True if

Write a function called dishlist_all_cheap that takes a list of Dishes (note how this is different from dish_is_cheap) and a number and returns True if the price of every dish on the list is less than that number. Of course dishlist_all_cheap will call dish_is_cheap; solutions that duplicate the code instead of using an already-defined function would receive little credit.

(c.8) Write a function called dishlist_change_price that takes a list of Dishes and a number representing a percentage change and returns a list of Dishes with each price changed by the specified amount. (Since lists are mutable, ask yourself how you'd write this differently if the specification were to change the list itself rather than returning a new list with changed prices.)

(c.9) Write a function called dishlist_prices that takes a list of Dishes and returns a list of numbers containing just the prices of the dishes on that list.

(c.10) Write a function called dishlist_average that takes a list of Dishes and returns the average price of those dishes. (Again, call previously defined functions wherever possible; don't reinvent the wheel.)

(c.11) Write a function called dishlist_keep_cheap that takes a list of Dishes and a number and returns a list of those dishes on the original list that have prices less than that number. This is much like keeping the consonants in a string.

(c.12) Create a list of at least 25 Dishes. Just make them up, but for this part it's perfectly fine to trade dishes with classmates other than your partner. Just check that the dishes you receive are correctly formed. Write a function called before_and_after that takes no parameters. It prompts the user for interactive input of a number representing a percentage change in prices; then it prints the result of dishlist_display on your big list of Dishes; then it changes all the prices of the Dishes on the big list; then it prints the result of dishlist_display again (reflecting the changed list of Dishes).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

Would you change the ending of the book? If so, how?

Answered: 1 week ago

Question

Is there a clear hierarchy of points in my outline?

Answered: 1 week ago