赞
踩
- 2.1温度转换
- temp = eval(input('''请输入温度:
- '''))
- c = input("请输入符号:")
- if c in ['F','f']:
- temp = int((temp-32)/1.8)
- print("温度:{}".format(temp))
- elif c in ['c','C']:
- temp = int(temp*1.8+32)
- print("温度:{}".format(temp))
- else:
- print("error")
- 2.2汇率
- temp = eval(input('''请输入金额:
- '''))
- c = input("请输入币种:")
- if c == 'RMB':
- temp = int(temp/6)
- print("$:{}".format(temp))
- elif c == '$':
- temp = int(temp*6)
- print("RMB:{}".format(temp))
- else:
- print("error")
- 2.3画乌龟
- import turtle
- def draw(r,ag,len):
- turtle.seth(-40)
- # for i in range(int(len)):
- turtle.pencolor("blue")
- turtle.circle(r,ag)
- turtle.circle(-r,ag)
- turtle.pencolor("green")
- turtle.circle(r,ag)
- turtle.circle(-r,ag)
- turtle.pencolor("pink")
- turtle.circle(r,ag)
- turtle.circle(-r,ag)
- turtle.pencolor("red")
- turtle.circle(r,ag)
- turtle.circle(-r,ag)
- turtle.circle(r,ag/2)
- turtle.fd(40)
- turtle.circle(16,180)
- turtle.fd(40*2/3)
- turtle.setup(650,350,200,200)
- turtle.penup()
- turtle.fd(-250)
- turtle.pendown()
- turtle.pensize(25)
- draw(40,80,4)
- turtle.done()
-
-
- 2.4
- 画
- from turtle import *
- setup(300,400,0,0)
- fd(100)
- left(120)
- fd(100)
- left(120)
- fd(100)
-
- 或者
-
- from turtle import *
- setup(300,400,0,0)
- fd(100)
- seth(120)
- fd(100)
- seth(240)
- fd(100)
-
- 或者
-
- from turtle import *
- setup(300,400,0,0)
- circle(200,steps = 3)
-
-
-
- 2.5
-
- from turtle import *
- setup(300,400,0,0)
- fd(200)
- seth(120)
- fd(200)
- seth(240)
- fd(200)
- seth(0)
- fd(100)
- seth(60)
- fd(100)
- seth(180)
- fd(100)
- seth(-60)
- fd(100)
-
-
- 2.6
-
- from turtle import *
- setup(300,400,0,0)
- for i in range(4):
- penup()
- fd(50)
- pendown()
- fd(100)
- penup()
- fd(50)
- left(90)
- 2.8
-
- from turtle import *
- setup(1000,1400,0,0)
- a=20
- for i in range(20):
- a = a+2*i
- fd(a)
- left(90)
- fd(a)
- left(90)
- 2.7
-
- from turtle import *
- seth(30)
- fd(200)
- left(120)
- fd(200)
- left(120)
- fd(200)
- left(90)
- t=(200/3)*pow(3,0.5)
- penup()
- fd(t)
- pendown()
- left(90)
- fd(200)
- left(120)
- fd(200)
- left(120)
- fd(200)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。