Prompts user for confirmation.

    :param prompt: String to display to user.
    :param resp: Default response value.

    :return: Boolean response from user, or default value.
431259
def confirm(prompt=None, resp=False):
    
    if prompt is None:
        prompt = 'Confirm'

    if resp:
        prompt = '%s [%s]|%s: ' % (prompt, 'y', 'n')
    else:
        prompt = '%s [%s]|%s: ' % (prompt, 'n', 'y')

    while True:
        ans = raw_input(prompt)
        if not ans:
            return resp
        if ans not in ['y', 'Y', 'n', 'N']:
            print 'please enter y or n.'
            continue
        if ans == 'y' or ans == 'Y':
            return True
        if ans == 'n' or ans == 'N':
            return False
265918
def user_choice(prompt, choices=("yes", "no"), default=None):
    
    assert default is None or default in choices
    choice_list = ', '.join((choice.title() if choice == default else choice for choice in choices))
    response = None
    while response not in choices:
        response = input(prompt + ' [' + choice_list + ']: ')
        response = response.lower() if response else default
    return response
1143033
public static boolean confirmPrompt(String prompt) throws IOException {   
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String input = null;
    do {
      System.out.print(prompt + " (Y or N) ");
      input = in.readLine();
    } while (input == null
        || (!input.equalsIgnoreCase("Y") && !input.equalsIgnoreCase("N")));    
    return input.equalsIgnoreCase("Y");
  }
452921
def prompt(text, default=None, show_default=True, invisible=False,
           confirm=False, skip=False, type=None, input_function=None):
	'''
	'''
	t = determine_type(type, default)
	input_function = get_input_fn(input_function, invisible)
	if default is not None and show_default:
		text = '{} [{}]: '.format(text, default)
	while True:
		val = prompt_fn(input_function, text, default, t, skip, repeat=True)
		if not confirm or (skip and val is None):
			return val
		if val == prompt_fn(input_function, 'Confirm: ', default, t, repeat=True):
			return val
		echo('Error: The two values you entered do not match', True)
1240158
def ask_confirmation(prompt = 'Continue?', default = false)
      a = ''
      s = default ? '[Y/n]' : '[y/N]'
      d = default ? 'y' : 'n'
      until %w[y n].include? a
        a = ask("#{prompt} #{s} ") { |q| q.limit = 1; q.case = :downcase }
        a = d if a.length.zero?
      end
      a == 'y'
    end
779139
def prompt_4_yes_no(question):
    
    while True:
        sys.stdout.write(question + ' (y/n)? ')
        try:
            choice = raw_input().lower()
        except:
            choice = input().lower()
        if choice == 'yes' or choice == 'y':
            return True
        elif choice == 'no' or choice == 'n':
            return False
        else:
            printError('\'%s\' is not a valid answer. Enter \'yes\'(y) or \'no\'(n).' % choice)
519166
def prompt(name, default):
    
    value = raw_input('%s [%s]: ' %(name, default))
    if not value:
        value = default
    return value
281127
def prompt_yes_or_no(message):
    
    user_input = input("{} [y/n]:".format(message)).lower()
    if user_input.startswith("y"):
        return True
    elif user_input.startswith("n"):
        return False
    else:
        return prompt_yes_or_no(message)
190194
def check_prompt_code(response):
        
        num_code = response.find("div", {"jsname": "EKvSSd"})
        if num_code:
            print("numerical code for prompt: {}".format(num_code.string))
1243394
def yesno(message, default='yes', suffix=' '):
    
    if default == 'yes':
        yesno_prompt = '[Y/n]'
    elif default == 'no':
        yesno_prompt = '[y/N]'
    else:
        raise ValueError("default must be 'yes' or 'no'.")

    if message != '':
        prompt_text = "{0} {1}{2}".format(message, yesno_prompt, suffix)
    else:
        prompt_text = "{0}{1}".format(yesno_prompt, suffix)

    while True:
        response = get_input(prompt_text).strip()
        if response == '':
            return True
        else:
            if re.match('^(y)(es)?$', response, re.IGNORECASE):
                if default == 'yes':
                    return True
                else:
                    return False
            elif re.match('^(n)(o)?$', response, re.IGNORECASE):
                if default == 'no':
                    return True
                else:
                    return False
4609
def confirm(prompt):
    
    while True:
        try:
            answer = input(prompt)
        except KeyboardInterrupt:
            # the user presses ctrl+c, just say 'no'
            return False
        answer = answer.strip().lower()
        if answer not in ('y', 'n'):
            print('Please enter y or n')
            continue
        return answer == 'y'
836734
def prompt(name, default=None):
    

    prompt = name + (default and ' [%s]' % default or '')
    prompt += name.endswith('?') and ' ' or ': '
    while True:
        try:
            rv = raw_input(prompt)
        except NameError:
            rv = input(prompt)
        if rv:
            return rv
        if default is not None:
            return default
1125525
def ask(question, default=None):
    
    question = str(question)

    if default:
        question += ' [' + str(default) + ']'

    question += ': '

    reply = raw_input(question)
    return reply if reply else default
760380
public function confirm($prompt, $default = null)
    {
        $prompt .= ' [';
        $prompt .= $default === true ? 'Y' : 'y';
        $prompt .= '/';
        $prompt .= $default === false ? 'N' : 'n';
        $prompt .= '] ';
        while (true) {
            $input = $this->get(':: ' . $prompt);
            if (! is_string($input)) {
                return false;
            }
            if ($input == '') {
                if (is_bool($default)) {
                    return $default;
                }
                continue;
            }
            $input = strtolower($input);
            if ($input == 'yes' or $input == 'y') {
                return true;
            }
            return false;
        }
    }
782167
def confirm_user(query):
    
    user = _query_to_user(query)
    if click.confirm(f'Are you sure you want to confirm {user!r}?'):
        if security_service.confirm_user(user):
            click.echo(f'Successfully confirmed {user!r} at '
                       f'{user.confirmed_at.strftime("%Y-%m-%d %H:%M:%S%z")}')
            user_manager.save(user, commit=True)
        else:
            click.echo(f'{user!r} has already been confirmed.')
    else:
        click.echo('Cancelled.')
1248239
def confirm(question, default=True):
    
    valid = {"": default, "yes": True, "y": True, "no": False, "n": False}
    while 1:
        choice = input(question + (" [Y/n] " if default else " [y/N] ")).lower()
        if choice in valid:
            return valid[choice]
        print("Please respond with 'y' or 'n' ")
1058841
def continue_prompt(message=""):
    
    answer = False
    message = message + "\n'Yes' or 'No' to continue: "
    while answer not in ('Yes', 'No'):
        answer = prompt(message, eventloop=eventloop())
        if answer == "Yes":
            answer = True
            break
        if answer == "No":
            answer = False
            break
    return answer