这是过度生产的管理系统的伪代码:
Add memory library module
Prompt; 1)search for item, 2)add over produced item
If search for item
Prompt input item number
If item number in database print available quantity
Else print “None available”
Else if add over produced item
Prompt input item number
If item number in database
Prompt “how many”
Add quantity to inventory
Else if item number not in inventory
Add item to inventory with quantity
答案 0 :(得分:0)
db = {}
while True:
if raw_input("Prompt; 1)search for item, 2)add over produced item > ") == "1":
item = raw_input("Item number? > ")
if item in db:
print("Available: " + str(db[item]))
else:
print("None available")
else:
item = raw_input("Item number? > ")
qty = int(raw_input("Quantity? > "))
if item in db:
db[item] += qty
else:
db[item] = qty