Question: from constants import ( PID , INV, DISC, PRICE, CID, AGE, BUDGET, SPID, PURCHASE _ NUM, DISCOUNT _ RATE ) # This function solution is

from constants import (PID, INV, DISC, PRICE, CID, AGE, BUDGET, SPID,
PURCHASE_NUM, DISCOUNT_RATE)
# This function solution is provided as an example of a function that uses
# constants, complete with correct documentation.
def get_pid(product: str)-> str:
'''Returns the ID of product 'product'.
Pre-condition: 'product' is a valid product.
>>> get_pid('372908ALL147')
'3729'
>>> get_pid('999999SEN999')
'9999'
'''
return product[PID:PID +4]
# This function solution is provided as an example of a function that uses
# constants, complete with correct documentation.
def get_inventory(product: str)-> int:
'''Returns the current inventory of product 'product'.
Pre-condition: 'product' is a valid product.
>>> get_inventory('372908ALL147')
8
>>> get_inventory('999999SEN999')
99
'''
return int(product[INV:INV +2])
# We provide the docstring for this function to help you get started.
def get_discount(product: str)-> str:
'''Returns the discount type of product 'product'.
Pre-condition: 'product' is a valid product.
>>> get_discount('372908ALL147')
'ALL'
>>> get_discount('999999SEN999')
'SEN'
'''
pass # replace this line with your solution
# We provide the docstring for this function to help you get started.
def get_price(product: str)-> int:
'''Returns the price of product 'product'.
Pre-condition: 'product' is a valid product.
>>> get_price('372908ALL147')
147
>>> get_price('999999SEN009')
9
>>> get_price('999999SEN089')
89
'''
pass # replace this line with your solution
if __name__=='__main__':
import doctest
doctest.testmod()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!