这是我到目前为止编写的代码。正如您所看到的,如果您运行代码,我遇到了最后6行及其功能的问题。
kegsize = input('Please enter keg size. Litres: ')
print (kegsize, 'Litres')
netpurchasecost = input('Please enter net purchase cost. GBP: ')
print ('£', netpurchasecost)
abv = input('Please enter Alcohol by Volume. %: ')
print (abv, '%')
gp = input('Please enter Gross Profit Percentage. %: ')
print (gp, '%')
opt = print('These are the Portion Size options (imperial measurements), 1/3, 1/2, 2/3, 1')
portionsize = input('Please choose Portion Size: ')
if portionsize != ['1/3' , '1/2' , '2/3' , '1']:
print('Please enter a Portion Size from the list')
else:
print(portionsize)
无论我输入的部分大小是' 1/3',' 1/2',' 2/3'或者' 1' shell仍将输出'请从列表中输入部分大小'。