Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

What is the stated purpose of business process re-engineering?

Answered: 1 week ago

Question

=+a) Is this an observational or experimental study?

Answered: 1 week ago

Question

Discuss the steps in the development planning process. page 399

Answered: 1 week ago

Question

Identify the cause of a performance problem. page 380

Answered: 1 week ago