我希望循环询问名称和金额,根据用户的选择,如果他们想继续,如果用户输入“y”,循环应该继续,否则如果用户输入“n”,循环应该终止,但如果我输入“n”,循环不会停止
import os
bidders={}
to_countinue=True
while to_countinue:
name=input("Enter your name:\t")
amount=int(input("\nBidding Amount:\t"))
bidders[name]=amount
count=input("\nIs there any other bidders (y/n):\t").lower
if count=="n":
to_countinue=False
os.system('cls')
max=0
won=""
for key in bidders:
if bidders[key]>max:
max=bidders[key]
won=key
os.system('cls')
print(f"The biiding was won by{key} with {max} bidding amount")
lower
将简单地为您提供该函数的地址,非常不可能等于"n"
如果要调用它,则需要使用
lower()
,如中所示:以下文字记录显示了不同之处:
相关问题 更多 >
编程相关推荐