Python基础-实践课之点球大战
2016-04-25 18:37
549 查看
mark:2016-04-25
#coding=utf-8 import time from random import choice #define a list to store the result result = [0,0] #define two funcation orientation =['1','2','3','4','5'] def kick(): print '===Round %d -you kick!==='%(i+1) print 'choose the kick orientation ' player_orientation = raw_input() print 'Computer is saving goal........' time.sleep(1) computer_orientation = choice(orientation) if player_orientation != computer_orientation: print 'GOAL!!!' result[0]= result[0] + 1 else: print 'WTF! 居然没中!' print 'Your Score:%d \nComputer Score:%d'%(result[0],result[1]) print '===Round %d -you Save!==='%(i+1) print 'Computer is kick ball........' time.sleep(1) computer_orientation = choice(orientation) print 'choose the save orientation ' player_orientation = raw_input() if player_orientation == computer_orientation: print 'Nice!Save Success!' else: print 'WTF! ' result[1] = result[1]+1 print 'Your Score:%d \nComputer Score:%d'%(result[0],result[1]) for i in range(5): kick() while(result[0] == result[1]): print '===Round %d -you kick!==='%(i+1) kick() if result[0] > result[1]: print "you win!" else: print 'you lose!'
相关文章推荐
- Python 标准库 —— pickle/gzip
- python自底向上的执行单元测试
- python logging模块的简单使用
- python_笔记8_生成列表,列表表达式
- python_笔记7_字符串截取(切片),有序集合,无序集合,迭代
- Python Logging模块-介绍与使用
- python环境变量自动配置脚本(setx使用)
- Python正则表达式指南
- python编码规范
- Python常用标准库操作
- python md5
- python的setdefault方法
- python读取excel文件生成sql文件
- python modules下载地址
- Python学习(二)基础语法
- python_笔记6_函数
- python读取鸢尾花数据集并进行训练测试集分割
- python ConfigParser模块详解
- 为什么在Python里推荐使用多进程而不是多线程?
- python_笔记5_set