Python使用turtule画五角星的方法

yipeiwu_com5年前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程序设计有所帮助。

相关文章

python实现判断一个字符串是否是合法IP地址的示例

一个刚结束的笔试题目,简单贴一下吧,下面是具体实现: #!usr/bin/env python #encoding:utf-8 ''' __Author__:沂水寒城 功能:判断一个...

Pytorch入门之mnist分类实例

本文实例为大家分享了Pytorch入门之mnist分类的具体代码,供大家参考,具体内容如下 #!/usr/bin/env python # -*- coding: utf-8 -*-...

Python中time模块和datetime模块的用法示例

time模块方法: time.time():获取当前时间的时间戳 time.localtime():接受一个时间戳,并把它转化为一个当前时间的元组。不给参数的话就会默认将time.tim...

pandas数值计算与排序方法

以下代码是基于python3.5.0编写的 import pandas food_info = pandas.read_csv("food_info.csv") # --------...

python SVD压缩图像的实现代码

python SVD压缩图像的实现代码

前言 利用SVD是可以对图像进行压缩的,其核心原因在于,图像的像素之间具有高度的相关性。 代码 # -*- coding: utf-8 -*- ''' author@cclplu...