list=[1,23,34,4] for i in range(0,len(list)): print(list[i]) list.remove(34); for i in range(0,len(list)): print(list[i]) print("shixinfa"); a=10; b=20; c=a+b; print(a+b); a=100 if a>=0: print (a); else: print (-a); print(3>9); data=ord('A'); print(data) result=chr(88); print(result); length=len("BCD") print(length) classmates=['shixinfa','zhangyan','lilaoshi'] classmates.append('sdfg') classmates.insert(1,'wsx') for i in range(0,len(classmates)): print(classmates[i]); tuple=(2,3,5); len=len(tuple); print(len) d={'shixinfa':23,'zhangyan':34,'tom':89} print(d['zhangyan']) sum = 0 for x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: sum = sum + x print(sum) print(abs(-29)) print(int(20.89)) def my_abs(x): if x>=0: return x; else: return -x; print(my_abs(-99)) def power(x, n): s = 1 while n > 0: n = n - 1 s = s * x return s print(power(4,2)); dd = {'a': 1, 'b': 2, 'c': 3} for key in dd: print(key)
基础的Python代码
最新推荐文章于 2023-12-05 14:13:07 发布