python基础语法训练

# 1、执行 Python 脚本的两种方式是什么?
'''
(1)"Lx-1-1 基础语法.py" shell
(2)python "Lx-1-1 基础语法.py" -h -i -p 80 23 25
'''

# 2、打印当前程序的命令行输入参数及 Python 系统路径。
import sys

# 打印当前程序的命令行输入参数
for i in sys.argv:
    print (i)

print ('\nPython 系统路径:',sys.path)

# 3、有趣的 Python 之 import this
import this

# 4、用 Python 绘制五角星
import turtle           # 导入turtle库包

turtle.pencolor("blue")  # 画笔颜色
turtle.fillcolor("red") # 填充颜色
turtle.begin_fill()     # 开始画,类似起笔
count = 1               # 计时器,用于计录次数

while count <= 5:       # 控制绘制次数
    turtle.forward(100) # 画笔绘制的方向,向前移动指定的距离
    turtle.right(144)   # 向右转144度
    count += 1          # 循环绘制

turtle.end_fill()       # 完成填充图片的绘制

你可能感兴趣的:(python)