酷代码 AI
菜单
服务商
DeepSeek字节豆包讯飞星火
更多选项

Python 实现根据邮件重量与加急选项计算邮费

以下是使用 Python 实现的代码: ```python weight, option = input().split() weight = int(weight) if weight <= 1000: fee = 8 else: extra_weight = weight - 1000 extra_fee = (extra_weight // 500 + (1 if extra_weight % 500!= 0 else 0)) * 4 fee = 8 + extra_fee if option == 'y': fee += 5 print(fee) ``` ######[AI写代码神器 | 124点数解答 | 2024-11-03 15:11:01]

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