Python第一周作业
1、五角星绘制
import turtle turtle.fillcolor("red") turtle.begin_fill() count = 1 while count <= 5: turtle.forward(100) turtle.right(144) count += 1 turtle.end_fill()

2、六边形绘制
import turtle turtle.left(30) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144)

3、叠加等边三角形绘制
import turtle as t t.setup(600, 600, None,None) t.pu() t.fd(-120) t.pensize(5) t.width(5) t.pencolor("darkgreen") t.pd() t.fd(250) t.seth(120) t.pencolor("black") t.fd(250) t.seth(-120) t.pencolor("blue") t.fd(250) t.pencolor("purple") t.fd(250) t.seth(0) t.pencolor("green") t.fd(250) t.pencolor("gold") t.fd(250) t.seth(120) t.pencolor("yellow") t.fd(250) t.seth(-120) t.pencolor("grey") t.fd(250) t.seth(120) t.pencolor("pink") t.fd(250)

4、说句心里话A
a = input() b = input() str1 = a + ',我想对你说,' + b print(str1)
5、N的多次方
n=eval(input()) for i in range(5): print(pow(n,i),end=" ") print(pow(n,5))
6、世界,你好!
print('世界,你好!')
7、M与N的数学运算
m=eval(input()) n=eval(input()) print(m+n,m*n,m**n,m%n,max(m,n))
8、Hellow World
MyName = input() str1 = "欢迎你,"+ MyName + "同学!" print(str1)
树懒爱睡,日常敲代码
努力营业

浙公网安备 33010602011771号