Python入门
来源:互联网 发布:淘宝古着是什么意思 编辑:程序博客网 时间:2024/06/06 02:30
用Python绘制蟒蛇小程序
import turtledef drawSnake (rad,angle,len,neckrad): for i in range(len): turtle.circle(rad,angle) turtle.circle(-rad,angle) turtle.circle(rad,angle/2) turtle.fd(rad) turtle.circle(neckrad+1,180) turtle.fd(rad*2/3)def main(): turtle.setup(1300,800,0,0) pythonsize=30 turtle.pensize(pythonsize) turtle.pencolor("blue") turtle.seth(-40) drawSnake(40,80,5,pythonsize/2)main()运行结果:
温度转换程序:
#温度转换a = input ("请输入带温度表示的符号的温度值:")if a[-1] in ['C','c']: f=1.8*float(a[0:-1])+32 print("转换后的温度为%.2fF:"%f)elif a[-1] in ['F','f']: c=(float(a[0:-1])-32)/1.8 print("转换后的温度为:%.2fC"%c)else: print("输入有误")
0 0
- Python入门
- python入门
- Python入门
- Python入门
- Python入门
- Python入门
- python入门
- Python入门
- Python 入门
- Python入门
- python入门
- Python入门
- python入门
- python入门
- Python入门
- python 入门
- python入门
- python入门
- mysql中的group by,having,order by,where用法
- Windows Server 2008 R2 WEB 服务器安全设置指南(三)之文件夹权限设置
- The Great Mixing
- C++虚函数的原理
- python标准库之zipfile
- Python入门
- 知识点积累
- android 手机内置,sd卡存储的存储路径和空间问题
- PHP高级应用
- AS
- php 多进程函数 pcntl
- Interval (树状数组)
- Java--我的编程规范
- 树