0
我不斷收到類型錯誤:「浮動」對象未標化的 想知道爲什麼類型錯誤:「浮動」對象未標化的Python 3
from math import log
class Logarithm(object):
def __init__(self, base = 0, number= 0):
self.base = float(base)
self.number = float(number)
the_logarithm = log(self.base[self.number])
def __str__(self):
return 'Your log = {}'.format(the_logarithm)
也,它應該是'self.the_logarithm'(均在'__init__'和'__str__' )。 – nvlass 2013-05-06 23:09:04