python - python,使用 if else 语句计算曲棍球薪水
问题描述
关于我正在创建的程序: 这是一个计算工资的作业问题,我没有做好。问题是要求用户输入五个输入。基本工资,进球,助攻,球员得分,对球员得分。使用输入来计算目标 + 辅助获得了多少。如果总分低于 75 分,则每分 5000 美元。如果总分高于 75 分,75 分以上每分 10,000 美元,其余 5000 美元。使用输入计算加减分。从针对玩家的目标中减去玩家的目标。如果总计为正,则为每点 25000 美元。然后显示赚取的总金额。
我在哪里: 我输入下来了,分数下来了,我觉得我的加减分代码是正确的,但它并没有将它计算到最终结果中。对于如何将所有内容加在一起并打印总计,我也有些困惑。
salary = int(input('Enter base salary for player: '))
goals = int(input('Enter goals scored by player: '))
asst = int(input('Enter assists credited to the player: '))
scored = int(input('Enter goals we scored when player was on the ice: '))
against = int(input('Enter goals against player, when player was on the ice: '))
scoring_point = 0
plus_minus = 0
if scoring_point > 75:
scoring_point = goals + asst
point_bonus_greater = (scoring_point - 75) * 10000
point_2 = point_bonus_greater + 375000
print ('total for points is: $', point_2)
elif scoring_point < 75:
scoring_point = goals + asst
scoring_point2 = scoring_point * 5000
print('total for points is: $', scoring_point2)
elif plus_minus > 0:
plus_minus2 = plus_minus * 25000
print ('total plus/minus: $', plus_minus2)
else:
print('i suck')
解决方案
推荐阅读
- java - 如何在 jpa 中使用选择查询来检索所有数据?
- excel - 如何更新/连接excel单元格中的特定值?
- javascript - 如何使用哈希向 url 添加查询参数?
- sql-server - 如何从 laravel 中的存储过程中获取最后插入的值?
- reactjs - React 是在内部创建 prevState 的深拷贝还是浅拷贝?
- php - 如何使用 PHP 数组正确呈现带有其他元素的 PayPal 按钮?
- wordpress - 在插件中使用默认的 Wordpress 翻译
- python - Python:虽然存在密钥,但在 Azure API 中出现密钥错误
- python - 如何在 Python 中使用 rpy2 获取 missForest 输出?
- javascript - JQuery 添加侦听器从控制台工作,而不是从 js 文件