Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I'm having trouble producing the following output. I'm using python. Also, please utilize comments when typing code so I can understand. Output: Welcome to
Hello, I'm having trouble producing the following output. I'm using python. Also, please utilize comments when typing code so I can understand.
Output:
Welcome to shop1 fruit shop
Welcome to shop2 fruit shop
For orders: [('apples', 1.0), ('oranges', 3.0)] best shop is shop1
For orders: [('apples', 3.0)] best shop is shop2
Directions and code image:
Here's the intended output of this script, once you fill it in: Welcome to shop1 fruit shop Welcome to shop2 fruit shop For orders: [('apples', 1.0), ('oranges', 3.0)] best shop is shop1 For orders: [('apples', 3.0)] best shop is shop2 from _future__ import print_function import shop def shopSmart (orderlist, fruitShops): orderList: List of (fruit, numPound) tuples fruitShops: List of FruitShops HILL "*** YOUR CODE HERE ***" return None if __name = '_main__': "This code runs when you invoke the script from the command line" orders = [('apples', 1.0), ('oranges', 3.0)] diri = {'apples': 2.0, 'oranges': 1.0} shop1 shop.FruitShop('shopl', diri) dir2 = {'apples': 1.0, 'oranges': 5.0} shop2 = shop.FruitShop("shop2', dir2) shops [shop1, shop2] print("For orders ", orders, ", the best shop is", shopSmart (orders, shops).getName()) orders = [('apples', 3.0)] print("For orders: ", orders, ", the best shop is", shopSmart (orders, shops).getName())Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started