#!/usr/bin/env python print ''' ===================================== You are asked to enter your password. You only have three attempts. ===================================== ''' def getPassword(mypass): running = True n = 0 while running: pword = raw_input('Enter your password: ') n += 1 if (pword == mypass): print ' You are now login ' running = False else: print ' Please try again' if (n == 3): print "You already had three attempts" print "Please contact the system administrator" break mypass = 'Rolland' getPassword(mypass)