#!/usr/bin/env python#file: login.py#date: 2016-01-10import os,sys //Import Module function wide = 50 //set width title = ' Cross fire ' //game name half = (Wide - len ( title) -2 // 2 //divisible print wide * ' * ' print half * ' * ' + ' ' + title + ' ' + half * ' * ' print wide * ' * ' //These three print is done by the game title While true: name = raw_input ("please input your Name to login for game: ") .strip () if len (name)  ==&Nbsp;0: //If the game name is empty print "you input enpty name, please try again! " continue if name == ' strike ': print "Welcome, %s!" %name for i in range (1,4): //password enter three chance passwd = raw_input ("Please input your password:") .strip () if passwd == ' 123456 ': print "Congratulation, the game is about to land! " sys.exit () //input correctly jump out of the loop else: print "Your password is wrong, you have three times, try again! " i += 1 continue else: key = raw_input ("Your account is not exist, do you want to register? (y/n) ") .strip () // Registration Information             &Nbsp; if key == ' Y ': user = raw _input ("Please input your name for user:") .strip () password = raw_input ("Please input your new password:") .strip ( ) if len (user) != 0 and len (password) != 0: //account password is not empty print "ok, register over, your account is %s, password is %s, and you can login game after five minute! " % (User,password) if len (user) == 0 or len ( Password) == 0: //account or password has an empty print "sorry, register account fail, Program will exit! " break
Attached game title Picture:
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/79/7D/wKiom1aSjaKBlkkmAAFSYWWbEwM872.jpg "title=" 333. JPG "alt=" wkiom1asjakblkkmaafsywwbewm872.jpg "/>
This article from "Experience from pain" blog, declined reprint!
Python---game login