benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf b0cf50ef-2302-5c92-9ca9-a405d8af50c4

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import mechanize
from bs4 import BeautifulSoup


def task_func(url, form_id, data):
    """
    Submits a form on a given webpage using mechanize and extracts the title of the response page.

    Parameters:
        url (str): The URL of the webpage containing the form.
        form_id (int): The index of the form to be submitted.
        data (dict): A dictionary containing form data keys and values.

    Returns:
        str: The title of the page resulting from the form submission.

    Notes:
        - If the page has no title, it returns 'No Title'.

    Requirements:
        - mechanize
        - bs4.BeautifulSoup

    Examples:
        >>> data = {'username': 'admin', 'password': 'password'}
        >>> title = task_func('https://www.example.com/login', 0, data)
        >>> isinstance(title, str)
        True
    """

instruct prompt

Submits a form on a given webpage using mechanize and extracts the title of the response page.
Note that: Notes: If the page has no title, it returns 'No Title'.
The function should output with:
    str: The title of the page resulting from the form submission.
You should write self-contained code starting with:

Code

import mechanize
from bs4 import BeautifulSoup
def task_func(url, form_id, data):

code prompt

Code

import mechanize
from bs4 import BeautifulSoup
def task_func(url, form_id, data):

entry point

task_func

libs

  • mechanize
  • bs4

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import