iT邦幫忙

0

為何鍵值無法與input值相乘

wun 2020-05-22 22:27:58829 瀏覽
  • 分享至 

  • xImage
  •  

dict1={"香蕉":20,"蘋果":50,"草莓":60}
f=input("請輸入水果:")
fq=int(input("請輸入數量"))
v=dict1.get(f)
vt=v*fq
print("你買的水果是",f,"合計費用",vt)

為何執行以上程式會錯誤??


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

0
aaaaaa10476
iT邦新手 5 級 ‧ 2020-05-24 05:51:52

input("請輸入水果:")
輸入 香蕉/蘋果/草莓
沒錯誤

我要留言

立即登入留言