Python使用turtule画五角星的方法

yipeiwu_com6年前Python基础

本文实例讲述了Python使用turtule画五角星的方法。分享给大家供大家参考。具体实现方法如下:

#!/usr/bin/env python
import turtle
import time
turtle.forward(100)
turtle.right(144)
time.sleep(1)
turtle.forward(100)
turtle.right(144)
time.sleep(1)
turtle.forward(100)
turtle.right(144)
turtle.forward(100)
time.sleep(1)
turtle.right(144)
turtle.forward(100)
time.sleep(3)

希望本文所述对大家的Python程序设计有所帮助。

相关文章

用TensorFlow实现lasso回归和岭回归算法的示例

用TensorFlow实现lasso回归和岭回归算法的示例

也有些正则方法可以限制回归算法输出结果中系数的影响,其中最常用的两种正则方法是lasso回归和岭回归。 lasso回归和岭回归算法跟常规线性回归算法极其相似,有一点不同的是,在公式中增加...

python Qt5实现窗体跟踪鼠标移动

我就废话不多说了, 直接上代码吧! from PyQt5.Qt import * import sys class Window(QWidget): def __init...

Python 词典(Dict) 加载与保存示例

Dict的加载: import json def load_dict(filename): '''load dict from json file''' with open(f...

在Python中如何传递任意数量的实参的示例代码

1 用法 在定义函数时,加上这样一个形参 "*形参名",就可以传递任意数量的实参啦: def make_tags(* tags): '''为书本打标签''' print('标...

对python中的try、except、finally 执行顺序详解

如下所示: def test1(): try: print('to do stuff') raise Exception('hehe') print('to r...