Question: Using Python. Create a function that updates the list. updateFruits(fruit_list, fruit) : takes the argument fruit_list, a fruit string such as fruit, cashier, cost. Then
Using Python.
Create a function that updates the list.
updateFruits(fruit_list, fruit) : takes the argument fruit_list, a fruit string such as "fruit, cashier, cost". Then update the fruit to a new cost or change cashier. The fruit, cashier, and cost in fruit argument is separated by comma (',') without any space which would modify the fruit_list in-place.
If the fruit is not found in fruit_list, then print "Not found."
If the fruit argument is empty, then print "None"
Let's say fruit_list = [["apple","A",1], ["pear","B",2], ["grapes","C",3]] and we want to update apple's cost to 2 or change cashier of apple to "B".
*This is what my program looks so far*def updateFruits(fruit_list, fruit): if fruit == []: print("None") else: if: else: print("Not found.")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
