Question: Provide python solution for this question. Thanks. Make Product: This option allows a product code and a quantity to make to be entered. Assume that
Provide python solution for this question. Thanks.
Make Product: This option allows a product code and a quantity to make to be entered. Assume that the letters in product code is unsorted and may be in uppercase or lowercase.
Must use the function def getPartsInCode(p):
last = p[0];count = 0 for curr in p: if curr == last: count += 1 else: print(f'{last}{count}',end = " ") last = curr count = 1
print(f'{last}{count}') p = input("Please enter the product code: ") getPartsInCode(p)
Display the following messages where appropriate:
-Invalid product code y where y is an non-existing product code.
Invalid quantity x where x is the a quantity to make, if x is zero or negative.
-x product y successfully made where x is the quantity made and y is the product code. The inventory should be updated.
-x product y made at the current inventory level. z outstanding. where x is the quantity made, z is the quantity that cannot be fulfilled, and y is the product code. The inventory should be updated according to the quantity made.
If a part is made and/or if there is outstanding product quantity, the details should be recorded in a file, transactions.txt on separate line in this format:
-if the product is made, record in this format: make code quantityMade
-if there is outstanding product quantity, record in this format: outstanding code quantityOutstanding
Example runs
Run 1
Enter product code: ABCD
Invalid product code ABCD
Run 2
Enter product code: ABBB
Enter quantity to make: -2
Invalid quantity -2
Run 3
Enter product code: ABBB
Enter quantity to make: 2
2 product ABBB successfully made
Run 4
Enter product code: ABBB
Enter quantity to make: 2
Insufficient inventory.
1 product ABBB made at the current inventory level.
1 outstanding.
Content of transaction.txt
# add to previous contents
make ABBB 2
make ABBB 1
outstanding ABBB 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
