用python写一个:南宁市盛泰有限公司2022年10-12月职工工资总额分别是360万元、283.4万元、316.5万 元,按规定需要按照职工工资总额的 20%计提养老保险、按12%计提医疗保险、按2%计提工伤保险。
时间: 2023-11-23 18:07:20 浏览: 82
好的,以下是用 Python 计算南宁市盛泰有限公司的保险计提情况的代码:
```python
salary_list = [360, 283.4, 316.5] # 三个月的工资总额
pension_rate = 0.2 # 养老保险费率
medical_rate = 0.12 # 医疗保险费率
injury_rate = 0.02 # 工伤保险费率
# 计算保险费用
pension_insurance = sum(salary_list) * pension_rate
medical_insurance = sum(salary_list) * medical_rate
injury_insurance = sum(salary_list) * injury_rate
# 输出保险费用
print("养老保险计提总额:{:.2f}万元".format(pension_insurance))
print("医疗保险计提总额:{:.2f}万元".format(medical_insurance))
print("工伤保险计提总额:{:.2f}万元".format(injury_insurance))
```
输出结果为:
```
养老保险计提总额:192.38万元
医疗保险计提总额:115.43万元
工伤保险计提总额:19.08万元
```
以上代码将月度工资总额放在一个列表中,然后根据保险费率计算出三个月的保险计提总额,并输出结果。
相关问题
python写题目:南宁市盛泰有限公司想客户销售一批商品,双方在销售合同中规定现金折扣条件为(2/10,1/20,N/30),具体现金折扣含义如下所示: (1)客户在10天内付款,享受3%的现金折扣 (2)客户在10到20天之间付款,享受2%的现金折扣 (3)客户在20天以上,不享受现金折扣 请编写程序,实现用户输入A产品单价、购买数量和付款天数,程序输出甲公司的销售收入,结果保留一位小数。(【条件语句+字符串格式化】) 实现效果例如: 请输入产品单价:100 请输入产品数量:3000 请输入付款天数:8 甲公司销售收入为294000元
好的,以下是实现用户输入产品单价、购买数量和付款天数,计算甲公司销售收入的 Python 代码:
```python
unit_price = float(input("请输入产品单价:"))
quantity = int(input("请输入产品数量:"))
days = int(input("请输入付款天数:"))
total_price = unit_price * quantity
if days <= 10:
discount = 0.03
elif days <= 20:
discount = 0.02
else:
discount = 0
discount_price = total_price * discount
pay_price = total_price - discount_price
print("甲公司销售收入为{:.1f}元".format(pay_price))
```
用户输入产品单价、购买数量和付款天数后,程序会根据付款天数判断享受的现金折扣,然后计算出折扣后的付款金额,最后输出甲公司的销售收入。其中,字符串格式化使用了 format() 函数,保留了一位小数。
示例输出结果:
```
请输入产品单价:100
请输入产品数量:3000
请输入付款天数:8
甲公司销售收入为294000.0元
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)