python小游戏#石头剪刀布游戏:

#石头剪刀布游戏:

import random #引入一个随机模块

print(“1剪刀 2石头 3布”)

men=input(“请您输入指令”)

pc=random.randint(1,3)

menwin_lists=[(men1 and pc3),(men2 and pc1),(men3 and pc2)] #赢的可能性

if men==menwin_lists: #电脑和人出现的情况

print(“您赢了”)

elif men==pc:

print(“平局”)

else:

print(“您输了”)

猜你喜欢

转载自blog.csdn.net/charuiyu/article/details/84594018