Commit 4239bc72 by BellCodeEditor

auto save

parent 1a446318
import random
import turtle
t = turtle.Turtle()
t.penup()
t.goto(-240,0)
text = "我的老师是恐龙抗狼老师"
for char in text:
font_size = random.randint(10,30)
text_color = (random.random(),random.random(),random.random())
t.color(text_color)
t.pendown()
t.write(char,font=("Arial",font_size,"normal"))
jump_distance = random.randint(20,50)
t.penup()
t.forward(jump_distance)
t.hideturtle()
turtle.done()
\ No newline at end of file
import turtle as t
t.bgcolor("palegreen")
t.speed(30)
t.pensize(5)
t.pencolor("orange")
t.fillcolor("yellow")
t.begin_fill()
t.penup()
t.goto(0,-200)
t.pendown()
t.circle(200)
t.end_fill()
#右眼
t.pensize(3)
t.penup()
t.goto(80,65)
t.pendown()
t.pencolor("brown")
t.fillcolor("white")
t.begin_fill()
t.circle(35)
t.end_fill()
t.pencolor("black")
t.fillcolor("black")
t.begin_fill()
t.circle(23)
t.end_fill()
#左眼
t.penup()
t.goto(-80,65)
t.pendown()
t.pencolor("brown")
t.fillcolor("white")
t.begin_fill()
t.circle(35)
t.end_fill()
t.pencolor("black")
t.fillcolor("black")
t.begin_fill()
t.circle(23)
t.end_fill()
t.pencolor("brown")
t.penup()
t.goto(0,-60)
t.pendown()
t.circle(-120,60)
t.left(180)
t.circle(120,120)
t.hideturtle()
t.done()
\ No newline at end of file
import random
player=input("请出拳:石头/剪刀/布")
list=["石头","剪刀","布"]
computer=random.choice(list)
print("计算机出拳:"+computer)
#player=input("请出拳:石头/剪刀/布")
#print("玩家出拳:"+player)
\ No newline at end of file
print("玩家出拳:"+player)
print("计算机出拳:"+computer)
if player in list:
if player==computer:
print("平局")
elif (player=="石头" and computer=="剪刀") or (player=="剪刀" and computer=="布") or (player=="布" and computer=="石头"):
print("你赢了")
else:
print("你输了")
else:
print("重新输入")
\ No newline at end of file
import turtle#导入画笔模块
import random#导入随机数模块
#设置画布背景色
turtle.bgcolor("palegreen")
#绘制风车叶片
def draw_blade(length):
turtle.begin_fill()#开始填充颜色
for i in range(3):#重复执行3次
turtle.forward(length)#
turtle.left(120)#左转度120
turtle.end_fill()#填充结束
turtle.colormode(255)#颜色模式
num_blade = 5#画5个
blade_length = 150#每个边长是150
#设置画笔属性
turtle.pensize(20)#第一笔粗细
turtle.color("grey")#第一笔为灰色
turtle.setheading(270)#画笔间隔270步
turtle.forward(300)#移动300步
turtle.backward(300)#后退300步
turtle.pensize(10)#笔的粗细
for i in range(num_blade):#重复执行num_blade次
color = (random.randint(0,255),random.randint(0,255),random.randint(0,255))#随机颜色
turtle.color(color)#画笔的颜色
draw_blade(blade_length)#调用函数
turtle.left(360/num_blade)#计算左转的角度
turtle.hideturtle()#隐藏画笔
turtle.done()#保存画布
import turtle as t
t.bgcolor("palegreen")
t.pensize(5)
t.pencolor("orange")
t.fillcolor("yellow")
t.begin_fill()
t.penup()
t.goto(0,-200)
t.pendown()
t.circle(200)
t.end_fill()
#右眼
t.pensize(3)
t.penup()
t.goto(80,65)
t.pendown()
t.pencolor("brown")
t.fillcolor("white")
t.begin_fill()
t.circle(35)
t.end_fill()
t.pencolor("black")
t.fillcolor("black")
t.begin_fill()
t.circle(23)
t.end_fill()
#左眼
t.penup()
t.goto(-80,65)
t.pendown()
t.pencolor("brown")
t.fillcolor("white")
t.begin_fill()
t.circle(35)
t.end_fill()
t.pencolor("black")
t.fillcolor("black")
t.begin_fill()
t.circle(23)
t.end_fill()
t.pencolor("brown")
t.penup()
t.goto(0,-140)
t.pendown()
t.circle(120,60)
t.circle(120,-120)
t.hideturtle()
t.done()
\ No newline at end of file
import turtle as t#导入画笔模块
import random as r#导入随机数模块
t.setup(1000,800)#设置窗口大小
t.screensize(800,600,'skyblue')#设置画布大小及画布颜色
def draw_circle(radius,color,y_position):#创建画笔函数,分别是半径,颜色,y轴
"""绘制圆形"""
t.penup()#创建一支画笔
t.pensize(3)#画笔大小是3
t.fillcolor(color)#填充颜色
t.goto(0,y_position)#移动到指定y轴位置
t.pendown()#落笔
t.begin_fill()#开始填充
t.circle(radius)
t.end_fill()#填充结束
def draw_bullet():
"""随机生成子弹点"""
t.penup()#创建一支画笔
t.goto(r.randint(-200,200),r.randint(-200,200))#随机生成子弹点
t.pendown()#落笔
t.dot(20)#半径为20的圆
#绘制5个圆形
draw_circle(240,'red',-240)#1
draw_circle(200,'orange',-200)#2
draw_circle(150,'yellow',-150)#3
draw_circle(100,'green',-100)#4
draw_circle(80,'skyblue',-80)#5
draw_circle(60,'blue',-60)#6
draw_circle(40,'Purple',-40)#7
#绘制10个随机生成的子弹点
for i in range(10):
draw_bullet()
#隐藏画笔
t.hideturtle()
#显示绘制窗口
t.done()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment