问题描述
elif opt==2:
nitem=str(input('enter the porduct name'))
nitemc=int(input('enter the item code'))
nstkq=int(input('enter stock qty'))
nitemtyp=str(input('enter item type'))
b={'itemname':nitem,'itemcode':nitemc,'item-type':nitemtyp,'stock':nstkq}
stock=stock.append(b,ignore_index=True)
x=str(input('do you want to add another one? \n "y" for yes "n" for no' ))
if x=='y':
<to repeat>
希望我会得到帮助,谢谢!!!!!!!
解决方法
elif opt==2:
while True:
nitem=str(input('enter the porduct name'))
nitemc=int(input('enter the item code'))
nstkq=int(input('enter stock qty'))
nitemtyp=str(input('enter item type'))
b={'itemname':nitem,'itemcode':nitemc,'item-type':nitemtyp,'stock':nstkq}
stock=stock.append(b,ignore_index=True)
x=str(input('do you want to add another one? \n "y" for yes "n" for no' ))
if x=='n':
break