Python---game login

Source: Internet
Author: User

#!/usr/bin/env python#file: 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=" "title=" 333. JPG "alt=" wkiom1asjakblkkmaafsywwbewm872.jpg "/>

This article from "Experience from pain" blog, declined reprint!

Python---game login

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.