benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf fa85986e-5eb7-5704-a55d-d0a89a9420b4

Problem

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

complete prompt

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


def task_func(list_input):
    """
    Sort the given list in ascending order based on the degree value of its elements, calculate the cumulative sum of 
    the sorted list, and draw a line chart of the cumulative sum.

    Parameters:
    list_input (list): The list to be sorted.

    Returns:
    tuple: A tuple containing:
           - numpy array: The cumulative sum of the sorted list.
           - matplotlib.axes._axes.Axes: The Axes object of the plotted line chart.

    Requirements:
    - math
    - numpy
    - matplotlib.pyplot

    Example:
    >>> cumsum, ax = task_func([10, 20, 30])
    >>> print(cumsum)
    [10 30 60]
    >>> ax.get_title()
    'Cumulative Sum Plot'
    """

instruct prompt

Sort the given list in ascending order based on the degree value of its elements, calculate the cumulative sum of the sorted list, and draw a line chart of the cumulative sum.
The function should output with:
    tuple: A tuple containing:
    numpy array: The cumulative sum of the sorted list.
    matplotlib.axes._axes.Axes: The Axes object of the plotted line chart.
You should write self-contained code starting with:

Code

import math
import numpy as np
import matplotlib.pyplot as plt
def task_func(list_input):

code prompt

Code

import math
import numpy as np
import matplotlib.pyplot as plt
def task_func(list_input):

entry point

task_func

libs

  • math
  • numpy
  • matplotlib

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