首页 > 解决方案 > 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')

标签: pythonpython-3.x

解决方案


推荐阅读