Python货币转换

在这里插入图片描述

service_menu = {1:"人民币转换美元",2:"美元转换人民币",3:"人民币转换欧元",0:"结束程序"}
#while True:
print('**********欢迎使用货币转换系统**********')

for k,v in service_menu.items():
    print(k,end="")
    print(".",end="")
    print(v)

Your_Choice = input("请选择您的服务:")

while 1:
    if Your_Choice == '1':
        print('欢迎使用人民币转换美元服务:')
        your_money = input("输入您要兑换的人民币:")
        print('您需要转换的人民币为:'+your_money+'元')
        RMB_to_US = float(your_money) / 7.14
        print('兑换成美元为:' + str(RMB_to_US)+"$")

        print(print('**********欢迎使用货币转换系统**********'))
        for k, v in service_menu.items():
            print(k, end="")
            print(".", end="")
            print(v)

        Your_Choice = input("请选择您的服务:")

    elif Your_Choice == '2':
        print('欢迎使用美元转换人民币服务')
        your_money = input("输入您要兑换的美元:")
        print('您需要转换的人民币为:'+your_money+'元')
        US_to_RMB = float(your_money) * 7.14
        print('兑换成人民币为:' + str(US_to_RMB)+"¥")

        print(print('**********欢迎使用货币转换系统**********'))
        for k, v in service_menu.items():
            print(k, end="")
            print(".", end="")
            print(v)

        Your_Choice = input("请选择您的服务:")
    elif Your_Choice == '3':
        print('欢迎使用人民币转换欧元服务')
        your_money = input("输入您要兑换的人民币:")
        print('您需要转换的人民币为:' + your_money + '元')
        RMB_to_EU = float(your_money) / 7.7
        print('兑换成美元为:' + str(RMB_to_EU) + "€")

        print(print('**********欢迎使用货币转换系统**********'))
        for k, v in service_menu.items():
            print(k, end="")
            print(".", end="")
            print(v)

        Your_Choice = input("请选择您的服务:")
    elif Your_Choice == '4':
        print('欢迎使用欧元转换人民币服务')
        your_money = float(input("输入您要兑换的欧元:"))
        print('您需要转换的欧元为:' + your_money + '元')
        EU_to_RMB = your_money * 7.7
        print('兑换成美元为:' + str(EU_to_RMB) + "¥")

        print(print('**********欢迎使用货币转换系统**********'))
        for k, v in service_menu.items():
            print(k, end="")
            print(".", end="")
            print(v)

        Your_Choice = input("请选择您的服务:")
    elif Your_Choice == '0':
        print('结束程序!')
        break




  • 6
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值