首页 > 编程语言 > 详细

python经典程序

时间:2019-03-27 16:23:02      阅读:186      评论:0      收藏:0      [点我收藏+]

输入输出

#判断输入整数是否在[0,100]之间
num = eval(input("请输入一个整数:"))
if num > 100 or num < 0: #判断[0,100]
	print("输入的整数小于0或大于100")
else:
	print("输入整数在0到100之间(含)")
temps=input("\n")

 

#斐波拉列数列
a,b=0,1
while a<1000:#输出不大于1000的序列
	print(a,end=‘,‘)
	a,b=b,a+b
temps=input("\n") 

 

#绘制七彩圆圈
import turtle
colors = [‘red‘,‘orange‘,‘yellow‘,‘green‘,‘blue‘,‘indigo‘,‘purple‘]
for i in range(7):
	c = colors[i]
	turtle.color(c,c)
	turtle.begin_fill()
	turtle.rt(360/7)
	turtle.circle(50)
	turtle.end_fill()
turtle.done()

 

#绘制五角星
from turtle import *
color(‘#CC00FF‘,‘red‘)
begin_fill()
for i in range(5):
	fd(200)
	rt(144)
end_fill()
done()

 

python经典程序

原文:https://www.cnblogs.com/leesinxl/p/10608227.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!