酷代码 AI
菜单
服务商

Python 编程:根据加油信息计算加油站应付款

以下是使用 Python 语言解决此问题的代码: ```python def calculate_price(a, b, c): if b == '92': price = 6.95 elif b == '95': price = 7.44 elif b == '97': price = 7.93 else: return "输入的汽油品种有误" if c =='m': discount = 0.05 elif c == 'e': discount = 0.03 else: return "输入的服务类型有误" total_price = a * price * (1 - discount) return total_price a, b, c = input().split() a = int(a) print("应付款:{:.2f}".format(calculate_price(a, b, c))) ``` ######[AI写代码神器 | 200点数解答 | 2024-10-25 08:45:41]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]