Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (20 points) (a) (10 points) Consider a list of tuples where each tuple contains three elements corresponding to a fruit's name, price, and the

image text in transcribed
3. (20 points) (a) (10 points) Consider a list of tuples where each tuple contains three elements corresponding to a fruit's name, price, and the number of available fruits. Write a function that takes such a list of tuples as input and returns a list that contains the names of each of the fruits in the given input. For example, if the given input is: fruits =[( apple', 11, 10), ('orange', 7.5, 8), ('kiwi', 30, 23)] then, the function should return the following list as output: ['apple', 'orange', 'kiwi'] (b) (10 points) Consider a list of tuples where each tuple contains three elements corresponding to a fruit's name, price, and the number of available fruits. Write a function that takes such a list of tuples as input and returns the list of fruits whose price is less than 12. For example, if the given input is: fruits = [( 'apple', 11, 10), ('orange', 7.5, 8), ('kiw1', 30, 23) ] then, the function should return the following list as output: ['apple', 'orange']

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

More Books

Students also viewed these Databases questions