Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I need some assistance in producing the correct buyLotsOfFruit function; I'm using python. Also, please utilize comments. Once the function is correct, it should

Hello, I need some assistance in producing the correct buyLotsOfFruit function; I'm using python. Also, please utilize comments.

Once the function is correct, it should produce the output Cost of [('apples', 2.0), ('pears', 3.0), ('limes', 4.0)] is 12.25

Directions:

""" To run this script, type

python buyLotsOfFruit.py

Once you have correctly implemented the buyLotsOfFruit function, the script should produce the output:

Cost of [('apples', 2.0), ('pears', 3.0), ('limes', 4.0)] is 12.25 """ from __future__ import print_function

fruitPrices = {'apples': 2.00, 'oranges': 1.50, 'pears': 1.75, 'limes': 0.75, 'strawberries': 1.00}

def buyLotsOfFruit(orderList): """ orderList: List of (fruit, numPounds) tuples

Returns cost of order """ totalCost = 0.0 "*** YOUR CODE HERE ***" return totalCost

# Main Method if __name__ == '__main__': "This code runs when you invoke the script from the command line" orderList = [('apples', 2.0), ('pears', 3.0), ('limes', 4.0)] print('Cost of', orderList, 'is', buyLotsOfFruit(orderList))

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

solve the following sin (4 x + T) = 6 = 1 1 i intervallet 0x T.

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago