酷代码 AI
菜单
服务商

Python 实现按入职年限和工时精准计算员工周薪

以下是使用 Python 语言解决此问题的代码: ```python import math years, hours = map(int, input().split()) if years < 5: normal_rate = 30 else: normal_rate = 50 if hours <= 40: salary = hours * normal_rate else: salary = 40 * normal_rate + (hours - 40) * normal_rate * 1.5 print("%.2f" % salary) ``` 当您运行此代码时,它会提示您输入员工的入职年数和周工作时间,然后按照给定的规则计算并输出周薪,精确到小数点后 2 位。 ######[AI写代码神器 | 156点数解答 | 2024-10-29 12:00:33]

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