Commit a2b166e7 by BellCodeEditor

auto save

parent 6545d00d
player = input("玩家出拳:")
print(“”)
\ No newline at end of file
# 玩家出拳
player = input("请出拳(石头/剪刀/布):")
print("玩家出拳:" + player)
# 计算机出拳
import random
list=["石头","剪刀","布"]
computer=random.choice(list)
print(computer)
\ No newline at end of file
import turtle
pen= turtle.Pen()
# 第一处错误是👇,没有创建画布screen
screen=turtle.Screen()
size=screen.textinput("提示","你想要多大的魔法阵呀?")
# 第二处错误是没有转换数据类型,size是字符串,需要转换为整数或浮点,才可以传递给circle()的第一个参数
len=int(size) #可以转换为整数
#len=float(size) #也可以转换为浮点数
pen.circle(len)
pen.circle(len,360,3)
pen.circle(len,60)
pen.circle(len,360,3)
turtle.done()
\ No newline at end of file
name = input("你叫什么名字呀?")
print (name + "你好")
\ No newline at end of file
# 玩家出拳
player = input("请出拳(石头/剪刀/布):")
print("玩家出拳:" + player)
\ No newline at end of file
import turtle
#背景颜色
screen=turtle.Screen()
screen.bgcolor("light blue")
#写字
pen=turtle.Pen()
pen.penup()
pen.goto(100,-100)
pen.write("Hi,诺依~\n用python写电子贺卡真是太有趣啦~\n我也喜欢python~\n——悟空 ",font=("Times",20,"normal") )
pen.hideturtle()
#画爱心
pen1=turtle.Pen()
pen1.pencolor("red")
pen1.pensize(5)
len=screen.textinput("提示", "你想要多大的爱心呀?")
lovesize=int(len)
pen1.left(45)
pen1.forward(2*lovesize)
pen1.circle(lovesize,180)
pen1.right(90)
pen1.circle(lovesize, 180)
pen1.forward(2*lovesize)
pen1.hideturtle()
turtle.done()
\ No newline at end of file
# 玩家出拳
player = input("请出拳(石头/剪刀/布):")
print("玩家出拳:"+player)
# 计算机随机出拳
import random
list = ["石头","剪刀", "布"]
computer = random.choice(list)
print("计算机出拳:"+computer)
# 显示结果
if player == computer:
print("平局")
elif (player=="石头" and computer=="剪刀")or(player=="剪刀" and computer=="布")or(player=="布" and computer=="石头"):
print("恭喜,你赢了")
else:
print("很遗憾,你输了")
\ No newline at end of file
# 答案
import turtle
pen = turtle.Pen()
color=input("你想要什么颜色的五角星呀?")
pen.fillcolor(color)
#绘制五角星#
pen.begin_fill()
for i in range(5): #重复执行5次
pen.forward(200) #向前移动200步
pen.right(144) #向右移动144度,注意这里的参数一定不能变
pen.end_fill() #结束填充红色
turtle.done()
\ No newline at end of file
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