“我需要打印出预计成绩”
这是我尝试过的代码,它运行了,但是停下来向我展示我提到的名为(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