Python常识
- Python 之父 Guido(龟叔)
- 常用的 IDE( Integrated Development Environment 集成开发环境 ):
(1) IDLE (自带默认的,初学者) (2) Pycharm (进阶) (3) wingIDE (4) Eclipse (5) IPython
程序基本格式 和 技巧
-
Python 用4个空格缩进而不是花括号{}(C语言)来表示程序块 -
Python区分大小写 -
注释 (1)行注释 # (2)段注释,使用三个连续单引号’’’ -
关闭交互窗口: (1) Ctrl+Z 和回车 (2) 输入 quit() (3)直接关闭命令行窗口 -
中断程序执行: Ctrl+C -
保存程序: Ctrl+s(养成保存的习惯)
处理问题 和 学习习惯
《程序员修炼手册》
www.bjsxt.com/xiulian.html
守:照着老师的保持一致,有敬畏心 破:在试错中发挥自己的独创 离:脱离老师的内容,自成一派
学习习惯: (1)先建立体系,抓大放小,不要过度纠结小细节 (2)遇到问题先尝试自己解决+csdn (3)遇到问题,保持兴奋感
开始学习图形化程序设计
- turtle操作
import turtle
turtle.showturtle()
turtle.write("龟叔")
turtle.forward(300)
turtle.color("red")
turtle.left(90)
turtle.forward(300)
turtle.goto(0,50)
turtle.goto(0,0)
turtle.penup()
turtle.goto(0,300)
turtle.pendown()
turtle.circle(100)
- 绘制奥运五环
import turtle
turtle.width(10)
turtle.color("blue")
turtle.circle(50)
turtle.color("black")
turtle.penup()
turtle.goto(120,0)
turtle.pendown()
turtle.circle(50)
turtle.color("red")
turtle.penup()
turtle.goto(240,0)
turtle.pendown()
turtle.circle(50)
turtle.color("yellow")
turtle.penup()
turtle.goto(60,-50)
turtle.pendown()
turtle.circle(50)
turtle.color("green")
turtle.penup()
turtle.goto(180,-50)
turtle.pendown()
turtle.circle(50)
- 使用海龟绘图,输出四个矩形
import turtle
turtle.width(3)
turtle.color("red")
for x in range(4):
turtle.forward(50)
turtle.left(90)
turtle.penup()
turtle.goto(0,0)
turtle.goto(65,0)
turtle.pendown()
for i in range(4):
turtle.forward(50)
turtle.left(90)
turtle.penup()
turtle.goto(0,0)
turtle.goto(0,-20)
turtle.pendown()
for i in range(4):
turtle.forward(50)
turtle.right(90)
turtle.penup()
turtle.goto(0,0)
turtle.goto(65,-20)
turtle.pendown()
for i in range(4):
turtle.forward(50)
turtle.right(90)
|