猫史档案馆


python 猜拳小程序

用户:YmBFAYmBFA查看:0 回复:0 评论:0 创建时间:2022-03-17T09:13:26


import random
import time

#猜拳小程序 石头1 剪刀2 布3 
#请大家多多点赞
i=10
name=input("请输入你的用户名")

while i<1000:
    com=random.randint(1,3)
    p=int(input("猜拳小程序 石头1 剪刀2 布3 退出4:"))
    if(p==4):
        i=2000
    else:

        if(p>0 and p<5):
            if(p==1 and com==2)or(p==2 and com==1)or(p==3 and com==1):
                print(name,"你赢了")
            elif(p==1 and com==1)or(p==2 and com==2)or(p==3 and com==3):
                print("平局")
            else:
                print(name,"你输了")
        else:
            print("只能输入1到3")
            time.sleep(5)
            print("还没走?")
            time.sleep(1)
            print("好吧你继续用吧")
            time.sleep(1)

print("谢谢使用",name)


回复

上一页1 页 / 共 0下一页