如果我选择2并去#Coin购买或出售,我如何跳过#Bitcoin花费?
#Bittrex Buy and Sell
choice=float(raw_input("Enter 1 Buy, 2 Sell : "))
if (choice!=1):
if (choice!=2):
sys.exit('Choice number {0} not valid. Please enter 1 to Buy or 2 to Sell'.format(choice))
#Bitcoin to spend
bitcoin=float(raw_input("Bitcoin to Spend: "))
#Market to trade at
trade = 'BTC'
#Coint to Buy
currency = raw_input("Coin: ")
答案 0 :(得分:0)
虽然我不是这样做的,但这是一种更清洁的方式来处理你追求的方法。
#Bittrex Buy and Sell
choice=float(raw_input("Enter 1 Buy, 2 Sell : "))
if choice not in [1,2]:
sys.exit('Choice number {0} not valid. Please enter 1 to Buy or 2 to Sell'.format(choice))
if choice == 1:
#Bitcoin to spend
bitcoin=float(raw_input("Bitcoin to Spend: "))
if choice == 2:
#Coint to Buy
currency = raw_input("Coin: ")
#Market to trade at
trade = 'BTC'