#__author__:Administrator} #data: 2017/11/2 product_list = [ ('Mac',9000), ('kindel',800), ('tesla',900000), ('python_book',105), ('bike',2000), ] saving = input('please input a money:') shopping_car = [] if saving.isdigit(): saving = int(saving) #方法一 # for i in product_list: # print(product_list.index(i),i) #方法二 while True: for i ,v in enumerate(product_list,1): print(i,v) choice = input('请选择商品编号[退出:q]:') if choice.isdigit(): choice = int(choice) if choice>0 and choice<=len(product_list): p_item = product_list[choice-1] if p_item[1]