我在python中创建一个新程序,搜索函数外部的数字,但它给了我这个错误:
float() argument must be a string or a number
这是我的代码:
def CalcKm(self, km, time):
if not km:
return 0
kmCalc = int((round(float(km) * float(time)) / 100) - .5) + int(int((round(float(km) * float(time)) / 100) - .5) > 0)
if kmCalc <= 0 and km > 0:
km = 1
else:
km = kmCalc
return km
.....
def Information(self):
km = 1
time = 2
if 0 == time:
continue
show = self.CalcKm(km, time)
self.Show()