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
# 玩家出拳
player=input("请出拳(石头、剪刀、布)")
print("玩家出拳为"+player)
import turtle
import random
list=["石头","剪刀","布"]
computer=random.choice(list)
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("玩家输了")
num=input("请输入边数")
print(type(num))
color=input("请输入颜色")
color_list=["red","green","blue","black","pink"]
if num=="随机":
num=random.randint(2,10)
else:
print("输入错误")
\ No newline at end of file
num=int(num)
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