Question: Please edit the python file to satisfied the 3 questions: Question 1 : Addition Open addition.py and look at the definition of add: def add
Please edit the python file to satisfied the questions:
Question : Addition
Open
addition.py and look at the definition of add:
def add :
"Return the sum of a and
YOUR CODE HERE
return
The tests called this with a and set to different values, but the code always returned zero. Modify this definition using the following code:
def add :
"Return the sum of a and
printPassed and returning
return
Now rerun the autograder for only the question q
python
autograder.py
Question q
Passed and returning
PASS: testcasesqadditiontest
add returns the sum of a and
Passed and returning
PASS: testcasesqadditiontest
add returns the sum of a and
Passed and returning
PASS: testcasesqadditiontest
add returns the sum of a and
### Question q: ###
Finished at ::
Provisional grades
Question q:
Total:
You now pass all tests, getting full marks for question Notice the new lines "Passed a which appear before PASS: These are produced by the print statement in add. You can use print statements like that to output information useful for debugging.
Question : buyLotsOfFruit function
Add a buyLotsOfFruitorderList function to
buyLotsOfFruit.py which takes a list of fruitpound tuples and returns the cost of your list. If there is some fruit in the list which doesn't appear in fruitPrices it should print an error message and return None. Please do not change the fruitPrices variable.
Total:
You now pass all tests, getting full marks for question Notice the new lines "Passed a which appear before PASS: These are produced by the print statement in add. You can use print statements like that to output information useful for debugging.
Question : buyLotsOfFruit function
Add a buyLotsOfFruitorderList function to
buyLotsOfFruit.py which takes a list of fruitpound tuples and returns the cost of your list. If there is some fruit in the list which doesn't appear in fruitPrices it should print an error message and return None. Please do not change the fruitPrices variable.
Run python
autograder.py until question passes all tests and you get full marks. Each test will confirm that buyLotsOfFruitorderList returns the correct answer given various possible inputs. For example, testcasesqfoodpricetest tests whether:
Cost of applespearslimes is
Question : shopSmart function
Fill in the function shopSmartordersshops in
shopSmart.py which takes an orderList like the kind passed in to FruitShop.getPriceOfOrder and a list of FruitShop and returns the FruitShop where your order costs the least amount in total. Don't change the file name or variable names, please. Note that we will provide the
shop.py implementation as a "support" file, so you don't need to submit yours.
Run python
autograder.py until question passes all tests and you get full marks. Each test will confirm that shopSmartordersshops returns the correct answer given various possible inputs. For example, with the following variable definitions:
orders 'apples', oranges
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
