init
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
|||||||
|
inventory = 0
|
||||||
|
total_units = 0
|
||||||
|
failed = 0
|
||||||
|
|
||||||
|
print("=== Stock Auditor ===")
|
||||||
|
print("Type 'quit' to exit.\n")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
user_input = input("Enter stock quantity: ").strip()
|
||||||
|
|
||||||
|
if user_input.lower() == "quit":
|
||||||
|
break
|
||||||
|
|
||||||
|
if not user_input.isdigit():
|
||||||
|
print("Error: Invalid input. Please enter a positive integer.\n")
|
||||||
|
failed += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
quantity = int(user_input)
|
||||||
|
|
||||||
|
if quantity < 0:
|
||||||
|
print("Error: Negative numbers are not allowed.\n")
|
||||||
|
failed += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
inventory += quantity
|
||||||
|
total_units += quantity
|
||||||
|
print(f"Stock added. Current inventory: {inventory}\n")
|
||||||
|
|
||||||
|
if inventory > 500:
|
||||||
|
print(f"ALERT: Overstock detected! Inventory ({inventory}) exceeds 500 units.")
|
||||||
|
break
|
||||||
|
|
||||||
|
print("\n--- Audit Report ---")
|
||||||
|
print(f"Total Units Processed: {total_units}")
|
||||||
|
print(f"Failed/Rejected Entries: {failed}")
|
||||||
Reference in New Issue
Block a user