作业14:购物车作业

时间:2022-11-23 17:14:10
# elsa = [11,22,33,44,55,77,88,99,111]
# dic = {}
# k1 =[]
# k2 =[]
# for i in elsa:
#     if i > 66:
#         k1.append(i)
#     if i < 66:
#         k2.append(i)
# dic.setdefault('k1',k1)
# dic.setdefault('k2',k2)
# print(dic)

# 购物车作业
# flag = True
# while flag:
#     shop = ['手机1','手机2','手机3','手机4']
#     for i in shop:
#         print(shop.index(i)+1,i)
#     num = input('请输入商品数字编号/输入Q或者q退出:')
#     if num.isdigit():
#         num = int(num)
#         if num > 0 and num <= len(shop):
#             print(shop[num-1])
#         else:
#             print('请输入',shop.index(i)-2,'至',len(shop),'有效的商品编号。')
#     elif num.upper() == 'Q': break
#     else:
#         print('您所输入的商品编号有误,请重新输入。')