Commit ec442405 by BellCodeEditor

save project

parent 6fe9c875
Showing with 36 additions and 12 deletions
import turtle
screen=turtle.Screen()
screen.bgcolor("pink")
pen=turtle.Pen()
pen.penup()
pen.goto(100,-100)
pen.write("吴晨雪,\n我想你了!",font=("Times",20,"normal"))
pen.hideturtle()
pen1=turtle.Pen()
pen1.pensize(10)
pen1.pencolor("red")
pen1.left(45)
pen1.forward(160)
pen1.circle(80,180) #半径为80,逆时针转180度画出半圆
pen1.right(90)
pen1.circle(80,180)
pen1.forward(160)
pen1.hideturtle()
turtle.done()
\ No newline at end of file
player=input("出拳:石头/剪刀/布") #玩家出拳
print("玩家出拳:"+player) player=input("出拳:石头/剪刀/布") #玩家出拳,并用变量player存储答案
import random print("玩家出拳:"+player) #打印玩家出拳答案
list=["石头","剪刀","布"] import random #导入random模块
computer=random.choice(list) #计算机随机出拳
print(computer) list=["石头","剪刀","布"] #创建列表,存储三个参数
if player==computer: computer=random.choice(list) #在列表中随机抽取一个元素存入变量computer中
print (平局) print(computer) #打印计算机出拳答案
#结果判断
if player==computer: #如果玩家出拳结果等于计算机出拳结果
print (平局) #打印 平局
#添加三个条件判断
elif (player=="石头" and computer=="剪刀") or (player=="剪刀" and computer=="布") or (player=="布" and computer=="石头"): elif (player=="石头" and computer=="剪刀") or (player=="剪刀" and computer=="布") or (player=="布" and computer=="石头"):
print("You are win") print("You are win") #打印玩家赢
else: else: #否则:条件都不成立
print("You are a loser") print("You are a loser") #打印玩家输
\ No newline at end of file \ 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