我正試圖編寫一個程序,要求用戶輸入產品名稱,價格和數量。從那裏,所有的信息將被添加到一個表(字典?)此外,一個ID號碼必須分配給所有創建的新項目。我對ID號段感到困惑。Python:添加一個條目?
items = {}
product = str(input("Enter the name of a product: "))
price = int(input("Enter a price: "))
quantity = int(input("Enter a quantity: "))
#Assign unique ID number.
我試圖讓下面的結果爲例:
ID#70271, shoes. 7 available, at $77.00
您將不得不詳細說明您的身份證號碼的要求。您還應列出您爲生成身份證號碼所嘗試的內容。 – Amber
多少個ID號碼? –