benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 262180b9-660a-5f05-9bb2-27dd53772ad8

Problem

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

complete prompt

import numpy as np
import matplotlib.pyplot as plt
import string

# Constants
ALPHABET = list(string.ascii_lowercase)

def task_func(word):
    """
    Draws a bar chart representing the positions of each letter in the given word 
    within the English alphabet using numpy and matplotlib.pyplot.
    
    Parameters:
    word (str): The word whose letters' positions will be plotted. 
                Should contain only lowercase alphabetic characters.
                
    Returns:
    Axes: A matplotlib.axes._axes.Axes object representing the generated plot.
    
    Requirements:
    - numpy
    - matplotlib.pyplot
    
    Constants:
    - ALPHABET: A list containing all lowercase letters of the English alphabet.
    
    Examples:
    >>> ax = task_func('abc')
    >>> ax = task_func('hello')
    
    Note: 
    The function uses the index of each letter in the English alphabet to represent its position.
    For example, 'a' will be represented by 1, 'b' by 2, and so on.
    """

instruct prompt

Draws a bar chart representing the positions of each letter in the given word within the English alphabet using numpy and matplotlib.pyplot. Constants: - ALPHABET: A list containing all lowercase letters of the English alphabet.
Note that: The function uses the index of each letter in the English alphabet to represent its position. For example, 'a' will be represented by 1, 'b' by 2, and so on.
The function should output with:
    Axes: A matplotlib.axes._axes.Axes object representing the generated plot.
You should write self-contained code starting with:

Code

import numpy as np
import matplotlib.pyplot as plt
import string
# Constants
ALPHABET = list(string.ascii_lowercase)
def task_func(word):

code prompt

Code

import numpy as np
import matplotlib.pyplot as plt
import string
# Constants
ALPHABET = list(string.ascii_lowercase)
def task_func(word):

entry point

task_func

libs

  • numpy
  • matplotlib
  • string

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