l1 = [11,22,33] l2 = [22,33,44] for item in l1: if item not in l2: print(item) #统计123455678组合两位数且不能重复 num=0; for item in range(1,9): for vtem in range(1,9): if item != vtem: num +=1 print(num) #九九乘法表 for i in range(1,10): string = '' for v in range(1,i+1): string += str(v) + '*' + str(i) + '=' + str(i*v) + ' ' print(string) #100//5表示取整,目的是减少程序的运行次数 for i in range(1,100//5): for v in range(1,100//3): for x in range(1,100): #思路 #三种鸡的数量加起来为100 总价格为100 if i+v+x == 100 and 5*i + 3*v + x/3 == 100: print(i,v,x) nums = [2,7,11,15,1,5,8,7] a=[]; for i in nums: for v in nums: if i + v == 9: a.append((1,v)) print(a) for i in range(1,10): print(i) #分页 user_list = [] for i in range(1,301): temp = {'name':'alex'+ str(i),'email':'laruencess@outlook.com'} user_list.append(temp) while True: page = input('>>>:') page = int(page) start = (page - 1) * 10 end = page * 10 result = user_list[start:end] for item in result: print(item,type(item)) #循环键 li = [11,22,33,44,55,66,77,88,99] for i in range(0,len(li)): print(i) #循环值 for i in li: print(i)