python脚本输出猜拳游戏小程序

#python脚本输出猜拳游戏小程序
import random
player=int(input('请出拳:0--剪刀 1--石头 2--布:'))
computer=random.randint(0,2)
if (player==0 and computer==2) or (player==1 and computer==0) or (player==1 and computer==0):
print('玩家获胜')
elif player == computer:
print('平局')
else:
print('电脑获胜')

 

posted @   听见时间  阅读(123)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
点击右上角即可分享
微信分享提示