学习内容
1、turtle画图模块的使用及绘制奥运五环图
# 绘制奥运五环图
import turtle
turtle.width(10)
turtle.color('blue')
turtle.circle(50)
turtle.penup()
turtle.goto(120,0)
turtle.pendown()
turtle.color('black')
turtle.circle(50)
turtle.penup()
turtle.goto(240,0)
turtle.pendown()
turtle.color('green')
turtle.circle(50)
turtle.penup()
turtle.goto(60,-50)
turtle.pendown()
turtle.color('yellow')
turtle.circle(50)
turtle.penup()
turtle.goto(120,-50)
turtle.pendown()
turtle.color('red')
turtle.circle(50)
画出的奥运五环如下:
2、python面向对象的概念:
1)id(地址)
2)type(类型)
3)value(值)
3、变量的命名规则
1)字母、数字、下划线组合,但必须以字母和下划线开头;
2)区分大小写;
3)不能使用python中的关键字;
4)变量、函数、对象一般使用小写字母,多个单词的话中间使用下划线;
5)类的命名遵循驼峰原则:每个单词的首字母大写;
6)常量的命名使用大写字母。