Commit 923c1737 by BellCodeEditor

save project

parent e563dd6e
Showing with 35 additions and 16 deletions
i=0
while i<10:
print("*"*i)
i=i+1
i=10
while i>0:
print("*"*i)
i=i-1
# 玩家出拳 import turtle
player=input("请出拳(石头、剪刀、布)")
print("玩家出拳为"+player)
import random import random
list=["石头","剪刀","布"] num=input("请输入边数")
computer=random.choice(list) print(type(num))
print("计算机出拳为"+computer) color=input("请输入颜色")
if player in list: color_list=["red","green","blue","black","pink"]
if player==computer: if num=="随机":
print("平局") num=random.randint(2,10)
elif(player=="石头" and computer=="剪刀") or (player=="剪刀" and computer=="布" ) or (player=="布" and computer=="石头"):
print("玩家赢了")
else:
print("玩家输了")
else: else:
print("输入错误") num=int(num)
\ No newline at end of file if color=="随机":
color=random.choice(color_list)
if not num>2 and num<10:
print("边数错误")
if not color in color_list:
print("颜色不对")
pen=turtle.Pen()
pen.fillcolor(color)
pen.begin_fill()
angle=180*(num-2)/num
for i in range(num):
pen.forward(random.randint(1,100))
pen.left(180-angle)
pen.end_fill()
turtle.done()
pen.hideturtle()
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