商品管理程式-增刪改查
阿新 • • 發佈:2021-10-13
1、寫一個商品管理的程式
1、新增商品:
input("name") #校驗是否存在,
input("price") #價格是大於0的數字,可以是小數
input("count") #大於的整數
2、修改
input("name") #校驗是否存在,不用修改商品名稱
input("price") #價格是大於0的數字,可以是小數
input("count") #大於的整數
3、查詢商品
name = input("name")
輸入all,顯示所有的商品
輸入商品名稱,那就顯示該商品的資訊
4、刪除
name = input("name")
刪掉商品即可
choice = input("請輸入你的選擇:1、新增、2、修改3、查詢4、刪除")
if choice == "1":
add_product()
elif choice == "2":
modify_procuct()
2、程式碼結構
3、get_product()函式
4、write_product(content)函式
5、get_product_name()函式
6、is_float(s)函式
7、get_price()函式
8、get_count()函式
9、add_product()函式
10、modify_product()函式
11、delete_product()函式
12、query_product()查詢函式
13、main()函式(2種方式)