1.1 2 3 4 5 6 7 8能组成多少个不同的两位数? count = 0for i in range(1,9): for V in range(1,9): if i != V: count+=1# count=count-8;print(count) #如果是列表[1,3,5,9]的形式,那么如下 ls = [1,3,5,9]count = 0for i in range(0,len(ls)): for V in range(0,len(ls)): if i != V: count+=1
python学习心得第三章 1.三元运算 变量=值1 if 条件 else 值2 由图如果条件成立则赋值1给变量,如果条件不成立则赋值2给变量. 2.数据类型 集合:set() class set(object): """ set() -> new empty set object set(iterable) -> new set object Build an unordered collection of unique elements. "&quo