随笔分类 - Python
摘要:1.九九乘法表 print('\n'.join([' '.join(["%2s ×%2s = %2s"%(j,i,i*j) for j in range(1,i+1)]) for i in range(1,10)])) #等价于以下语句: for i in range(1,10): print(""
阅读全文
摘要:整个集合大概是按照难易程度排序,简单常见的在前面,比较少见的在最后。 1.1 拆项 >>> a, b, c = 1, 2, 3 >>> a, b, c (1, 2, 3) >>> a, b, c = [1, 2, 3] >>> a, b, c (1, 2, 3) >>> a, b, c = (2 *
阅读全文
摘要:1.turtle绘制奥运五环图 import turtle as p def drawCircle(x,y,c='red'): p.pu()# 抬起画笔 p.goto(x,y) # 绘制圆的起始位置 p.pd()# 放下画笔 p.color(c)# 绘制c色圆环 p.circle(30,360) #
阅读全文