博客
关于我
Python 实现简单的石头剪刀布小游戏
阅读量:319 次
发布时间:2019-03-04

本文共 334 字,大约阅读时间需要 1 分钟。

直接上代码:

import randomperson = int(input('请输入石头[0],剪刀[1],布[2]:'))computer = random.randint(0,2)print('机器人输入的是:%d'%(computer))if person == 0 and computer == 1:    print('你赢了')elif person == 1 and computer == 2:    print('你赢了')elif person == 2 and computer == 0:    print('你赢了')elif person == computer:    print('平手')else:    print('你输了')

转载地址:http://vgoq.baihongyu.com/

你可能感兴趣的文章
NAT-DDNS内网穿透技术,快解析DDNS的优势
查看>>
NAT-DDNS内网穿透技术,快解析DDNS的优势
查看>>
NAT-DDNS内网穿透技术,解决动态域名解析难题
查看>>
natapp搭建外网服务器
查看>>
NativePHP:使用PHP构建跨平台桌面应用的新框架
查看>>
nativescript(angular2)——ListView组件
查看>>
NativeWindow_01
查看>>
Native方式运行Fabric(非Docker方式)
查看>>