我不断收到 TypeError: 'float' object is not subscriptable 想知道为什么
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)