Welcome, guest | Sign In | My Account | Store | Cart

This snippet of code was written as part of an article - Password Protecting You Python Application

Python, 16 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import sys

def main():

	print '\nPassword Request Program v.01\n'
	
	password = 'abcd'
	user_input = raw_input('Please Enter Password: ')
	
	if user_input != password:
		sys.exit('Incorrect Password, terminating... \n')
		
	print 'User is logged in!\n'
	
if __name__ == "__main__":
	main()