摘要: goods = [{"name":"电脑","price":1999}, {"name":"鼠标","price":10}, {"name":"游艇","price":20}, {"name":"美女","price":998}]for i in goods: k,v = i.values() pr 阅读全文
posted @ 2019-05-29 15:27 冰灬荷 阅读(928) 评论(0) 推荐(0) 编辑
摘要: dic = {}lst1 = []lst2 = []li = [11,22,33,44,55,66,77,88,99,90]for i in li: if i > 60: lst1.append(i) elif i < 60 : lst2.append(i)dic["k1"] = lst1dic[" 阅读全文
posted @ 2019-05-29 14:52 冰灬荷 阅读(122) 评论(0) 推荐(0) 编辑
摘要: dic ={}s = "k:1|k1:2|k2:3|k3:4"lst = s.split("|")for i in lst: lst1 =i.split(":") #k,v = i.split(":") dic(k) = int(v) dic[lst1[0]] = int(lst1[1])print 阅读全文
posted @ 2019-05-29 14:47 冰灬荷 阅读(492) 评论(0) 推荐(0) 编辑
摘要: count = 1lst = []lst1 = []while count <=10: name = input("请输入您心仪的女生(您还可以输入%s个):" % (11-count)) lst.append(name) count = count +1print("您当前心仪的女生有:")for 阅读全文
posted @ 2019-05-29 10:10 冰灬荷 阅读(192) 评论(0) 推荐(0) 编辑
摘要: number = int(input("请输入一个数字:"))lst = []for i in range(number+1): if i == 7: lst.append("咣") else: lst.append(i)print(lst) 阅读全文
posted @ 2019-05-29 09:05 冰灬荷 阅读(272) 评论(0) 推荐(0) 编辑
摘要: lis = []sum = 0while True: content = input("请输入成绩(格式如下张三_44),输入Q退出:") if content == "Q": break else: lis .append(content)for i in lis: s = i.split("_" 阅读全文
posted @ 2019-05-29 08:10 冰灬荷 阅读(218) 评论(0) 推荐(0) 编辑