TypeError:*:'NoneType'和'NoneType'不受支持的操作数类型

时间:2019-06-16 13:16:49

标签: python typeerror

“我需要打印出预计成绩”

这是我尝试过的代码,它运行了,但是停下来向我展示我提到的名为(ps)的项目得分

class score():

    def __init__(self):
       pass
    def runs(self,):
        while True:
            runs=float(input('Runs: '))
            return runs

    def overs(self):
        while True:
            overs=float(input('Overs: '))
            return overs


    def runrate(self,runs,overs):
        runrate =runs/overs
        print("RunRate:",runrate)

    def rem(self,overs):
        rem=(float(50)-overs)
        print ("RemainingOvers:",rem)

    def ps(self,runrate,rem):
        pscore = runrate * rem
        print("ProjectedScore:",(pscore))

    def loop(self):
        while True:

            runs=self.runs()
            overs=self.overs()
            runrate=self.runrate(runs,overs)
            rem=self.rem(overs)
            ps=self.ps(runrate,rem)

game=score()
game.loop()

输出:

Runs: 100
Overs: 32
RunRate:  3.125
Remaining Overs 18.0
#This should come out but here my code blows up..
Projected Score: 56.25

0 个答案:

没有答案