37 lines
889 B
Python
37 lines
889 B
Python
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}")
|