簡體   English   中英

Python-貨幣轉換器不是實時的

[英]Python- Currency converter not real time

在此處輸入圖像描述

主要是做這張圖片所做的但是我仍然卡在這里在此處輸入圖像描述

您以錯誤的方式輸入貨幣。 替換為以下代碼:

amount = int(input("Please enter an amount to convert"))

if con=='a':
    print(amount,'converts to ',amount*0.57)

此外,要添加更多貨幣類型,而不是鍵入所有內容,只需將它們以這種方式放入數組中:

currencies = [['CAD','GBP'],['CAD','USD'],['CAD','JPY'],['CAD','EUR']]
for i in range(len(currencies)):
    print(i+1,' ',currencies[i][0],' to' ,currencies[i][1])
    #change alphabet to integers
con = int(input("Please select the type of conversion"))
if con == 1:
    print(amount,' ',currencies[i-1][0], converts to ',currencies[i-1][1],amount*0.57)

    

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM