不支持的操作数类型:“ str”和“ str”

时间:2019-03-16 23:11:03

标签: python python-3.x

非常感谢您的帮助

1 个答案:

答案 0 :(得分:1)

在第124行中,您应该转换成int以进行减法。然后更改为str进行打印:

if Final2 > Final1:
    print("Player 2 won round 1 by " + str(int(Final2) - int(Final1)) + " points")
elif Final1 > Final2:
    print("Player 1 won round 1 by " + str(int(Final1) - int(Final2)) + " points")