このコードを実行すると、のpython 3.xの - "はTypeError:「int型のオブジェクトが呼び出し可能ではありません"
#Silent Auction
class Auction:
def __init__(self):
self.reserve_price = 30
self.highest_bid = 0
self.highest_bidder = ""
self.namelist = []
self.bidlist = []
def reserve_price(self):
print("Hello. The reserve price is ${}".format(self.reserve_price))
def new_bidder(self):
LOOP = 0
while LOOP == 0:
name = input("What is your name? 'F' for FINISH ")
if name.upper() == "F":
LOOP = 1
else:
bid = int(input("Hello {}. What is your bid? ".format(name)))
if bid > self.highest_bid:
self.highest_bid = bid
self.highest_bidder = name
self.namelist.append(name)
self.bidlist.append(bid)
else:
print("Sorry {}. You'll need to make another higher bid.".format(name))
print("Highest bid so far is ${:.2f}".format(self.highest_bid))
def auction_end(self):
if self.highest_bid >= self.reserve_price:
print("The auction met the reserve price and the highest bidder was {} with ${:.2f}".format(self.highest_bidder, self.highest_bid))
else:
print("The auction did not meet the reserve price")
n = len(self.namelist)
for i in range (0, n):
print("{} bid ${:.2f}".format(self.namelist[n], self.bidlist[n]))
if __name__ == "__main__":
auction1 = Auction()
auction1.reserve_price()
auction1.new_bidder()
auction1.auction_end()
私は
Traceback (most recent call last):
File "F:\Work\Year 13\13DIP\91637 Programming\Silent Auction.py", line 46, in <module>
auction1.reserve_price()
TypeError: 'int' object is not callable
>>>
これは無料のデバッグサービスではありません。あなたはコード全体とスタックトレースをダンプするよりももう少し作業をしなければなりません。 –