python---游戏登录
2016-03-20 10:15
591 查看
#!/usr/bin/env python #coding=utf-8 import os,sys width = 30 title = '穿越火线' len_title = len(title) half = (width - len_title) // 2 i = 0 print '*'*width print '*'*half+' '+title+' '+'*'*half print '*'*width while True: name = raw_input('Please input your name: ') .strip() if name == 'strike': print "Welcome, %s!" % name for i in range(3): password = raw_input('Please input your password:') p = '123' if password !=p: print "Wrong password!" continue i += 1 else: print "%s" %title break else: print 'Three times over, program will exiting!' break else: print "%s is not exist." % name YN = raw_input('Do you want to sign your owner name,input Y/N: ') if YN == 'Y': print "Signing..." os.system('sleep 2') continue if YN == 'N': print "Program exiting...!" break
本文出自 “经验来自痛苦” 博客,谢绝转载!
相关文章推荐
- Python回顾与整理4:序列2—列表与元组
- Python-面向对象
- python字符串连接超过2个,用join代替+号
- Keras - 一个基于 Theano 的深度学习 Python 库
- Python之反射
- python中dir(), hasattr(), getattr(), setattr()的使用
- python中的装饰器Decorator用法
- 第一个python程序
- python函数lambda(), filter(), map(), reduce()
- python装饰器
- python数据分析-处理CSV/EXCEL表格文件
- python常用绘图软件包记录
- IPython使用学习笔记
- 感知机Python实现
- 整数的十进制、二进制、八进制与十六进制
- python 字符串转浮点数
- 两个命令把 Vim 打造成 Python IDE的方法
- 总结Python编程中函数的使用要点
- 深入解析Python中函数的参数与作用域
- 举例讲解Python中的迭代器、生成器与列表解析用法