|
发表于 2023-10-4 15:44:24
|
显示全部楼层
你的代码中存在一些格式和逻辑错误。首先,else 语句应该与相应的 if 语句对齐。其次,你需要在 for 循环中使用 i 来访问 standardprofit 和 pushmoney 列表的元素。以下是修改后的代码:
- realprofit = int(input('请输入月利润:'))
- standardprofit = [0, 100000, 200000, 400000, 600000, 1000000]
- pushmoney = [0.1, 0.075, 0.05, 0.03, 0.015, 0.01]
- sum = 0
- realpushmoney = 0
- for i in range(0, 6):
- if realprofit > standardprofit[ i]:
- realpushmoney = (realprofit - standardprofit[ i]) * pushmoney[ i] + realpushmoney
- sum = 100000 * 0.1 + realpushmoney
- else:
- break
- print("总提成:", sum)
复制代码
这个修改后的代码应该可以正常运行。else 语句现在与相应的 if 语句对齐,for 循环中的 i 用于访问 standardprofit 和 pushmoney 列表的元素。
如果问题已经解决,请设置最佳答案 |
|