Python商品購買 小程式

2021-10-03 18:55:29 字數 589 閱讀 6904

』』』 設計乙個程式,完成(英雄)商品的購買

展示商品資訊(折扣)->輸入商品**->輸入購買數量->提示付款

輸入付款金額->列印購買小票(擴充套件)

『』』print(" 「)

print(「王者榮耀****折扣3.8折,需要支付28元人民幣」)

print(」 「)

a =int (input(「請輸入購買數量:」))

b = 28 * a

print(」 「)

print(「你購買的**,所需金額為%s」%b)

print(」 ")

c =int (input(「請支付商品需要的金額:」))

if b == c:

print(" 「)

print(」 支付成功")

print(" 「)

print(「正在列印購買小票,請稍後…」)

else:

print(」 ")

print(「支付金額錯誤,請重新支付」)

Python商品清單並購買小練習(列表等)

codeing utf 8 time 2021 2 3 16 55 author lzp file product test.py software pycharm products iphone 6888 macpro 14800 小公尺6 2499 coffee 31 book 60 nike ...

python基礎程式設計簡單案例 購買商品

goods dict 002 003 004 def goods info print 20 列印商品列表 20 print 商品編號 t商品名稱 t商品 for i in goods dict.keys print t t format i,goods dict i name goods dict...

python3 從零單排3 函式 購買商品小程式

題目如下 商品檔案products.txt裡存的內容如下 使用者檔案user.txt裡存的內容如下 xg 管理員可以操作 1.給使用者充值,輸入使用者名稱,修改money,100000 2.新增商品 3.logout 普通使用者可以操作 1.看商品資訊 2.買東西,a.東西加products,mon...