passwd = ' Test ' creates a variable
Logout_flag = False if login equals false, continue to enter password
For I in range (4): Loop 4 times
User_input = raw_input ("Please input your passwd:"). Strip () assigning user input passwd times
If Len (user_input) = = 0:continue count from 0 onwards, continue continued meaning
if user_input = = passwd: Determine user input password
While true: if the login is true, select the following options
Print "Welcome login!"
User_choice = Raw_input ("'
1. Run a cmd
2. Send a file
3. Exit this level
4. Exit the whole system
"). Strip ()
user_choice = Int (user_choice)
if User_choice = = 1: rolled out until 4 cycles
Print "Going to run cmd"
if User_choice = = 2:
Print "Going to sed a file"
if User_choice = = 3:
Print "Going to exit this"
Break
if User_choice = = 4:
Logout_flag = Ture
Break Break represents exit while True: Loop
If Logout_flag:
Print "Going to logout"
Break Break represents exiting for loop
Print "---going to do something else ..."
This article is from a "glass of water" blog, please be sure to keep this source http://6528161.blog.51cto.com/6518161/1916475
Python process judgment multi-layer cycle learning notes