from __future__ import print_function

def prompt(question, retry=3):
    while retry > 0:
        inp = raw_input('{} ({}): '.format(question, retry))
        if inp == 'my secret':
            return True
        retry -= 1
    return False

print(prompt("Type in your password"))

print(prompt("Type in your secret", 1))

Function parameters can have default values. In such case the parameters are optional. In the function declaration, the parameters with the default values must come last. In the call, the order among these arguments does not matter, and they are optional anyway.