Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Considering the code provided answer the following questions a. What are the names of the functions and what does each one do? b. Which

1. Considering the code provided answer the following questions

image text in transcribed

a. What are the names of the functions and what does each one do?

b. Which functions are Value-Returning Functions?

c. Which functions are Non-Value-Returning Functions?

d. Are there any global variables? If so, mention them

e. Are there any local variables? If so, mention them.

f. Write the statement to invoke each of the functions and what is the output when the function is called (prints, values, etc.)

Ex: See the total sales of the day

Statement: see_sales()

Output: Total Sales: 0

i. See the menu

ii. See Inventory

iii. Add an item

iv. Purchase an item

v. See total amount of money in inventory

sales =0 inventory = [['Item! ' , 2.20], ['1tern2 ' , 4.36], ['1tem3-12.32]] def show menu ): print ('1) Purchase n' '2) See inventory ' '3) Add Item ' '4) See sales ') def see_inventory): for idx in inventory: print (idx[0]+""+str (idx[1])) def add item (item, price): inventory.append ([item,price]) def purchase ): for idx in range (len (inventory) print (str (idx)) tinventory[idx] [0]) index = int (input ('Select a number: if Index >=0: ')) item = inventory [index] del inventory[index] return item[1] #Item price else: print ('Item not found') return 0 def amount_in_inventory): acum = 0 for idx in inventory: acum+=idx [ 1 ] return acum def see sales (): print ('Total Sales: '+sales)

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_2

Step: 3

blur-text-image_3

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

Write the properties of Group theory.

Answered: 1 week ago

Question

How is slaked lime powder prepared ?

Answered: 1 week ago

Question

Why does electric current flow through acid?

Answered: 1 week ago

Question

What is Taxonomy ?

Answered: 1 week ago

Question

1. What might have led to the misinformation?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago