您的位置:首页 > 编程语言 > Python开发

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


本文出自 “经验来自痛苦” 博客,谢绝转载!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: