一些用途是输入一个项目的出价,他们有一个特定的买家编号。我只能循环它以便在一个项目上出价。请帮助我如何通过最终询问用户是否想要寻找另一个项目来再次启动程序项目。
item_byer=(input("enter the item number
you want to buy:"))
k=0
for e in (bids_1):
if e==item_byer:
print("item is founded")
break
else:
print("not founded")
k+=1
index_1=(bids_1.index(item_byer))
price=(bids_1[(index_1)+2])
description=(bids_1[(index_1)+1])
print("the price of the item
is,",price)
bids=0
bids=price
print("if you want to enter a bid
please enter this word,bid()")
def bid():
global bids
buyer_num=input("enter your buyer
number!")
highest=input("enter the bid you want
to put on this. make sure it is greater
than previous")
a=0
while int(bids)>int(highest):
print("bids cannot be transfered it
should be greater than current
highest")
highest=input("enter your bid again")
a+=1
if (bids)<(highest):
print("bid accepted")
highest==bids
print("the current highest bid
is",highest)
bids=highest
else:
print("bid denied it should be
greater than the previous")
quit
biding=input("if you want to enter a
bid enter yes ")
if biding=="yes":
bid()
choice=input("if you want to input
another item press yes")
因为有太多错误,但坚持你最初提出的问题:我怎么能通过最终询问用户是否想要寻找另一个项目来再次启动程序。
你可以把你的工作代码放在一个循环中,最后接受用户输入,也许:
bids_1 = ['some', 'list', 'of', 'OP']
while True:
item_ = input("enter the item number you want to buy: ")
if item_ in bids_1:
print("item is found")
else:
print("item not found")
userInp = input("Do you want to check for another item? Press Y to continue: ")
if userInp.upper() != 'Y':
break