网中网 发表于 2018-8-13 10:53:46

python笔记:购物车

product_list=[  
    (,),
  
    (,),
  
    (,),
  
    (,),
  
    (,),
  
    (,),
  
]
  
shopping_list = []salary = ()salary.isdigit():salary =(salary)
  
    :
  
      index,item (product_list):(index,item)
  
      user_choice = ()
  
      user_choice.isdigit():user_choice =(user_choice)user_choice< (product_list) user_choice >=:p_item =product_listp_item[]<= salary:shopping_list.append(p_item)salary -= p_item[](%(p_item,salary))
  
                :
  
                  (%salary)
  
            :
  
                  (% user_choice)
  
      user_choice ==:()
  
            p shopping_list:
  
                (p)
  
            (,salary)
  
            ()
  
    :
  
      ()
页: [1]
查看完整版本: python笔记:购物车