benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 462082dd-515c-5f08-bc0f-28f1c27f857b

Problem

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

complete prompt

import pandas as pd
import statistics
import random

def task_func(students, subjects, seed=None):
    """
    Create a grade report for a list of students across various subjects. Each student's grades are randomly generated, 
    and the report includes the average grade for each student. The randomness is seeded for reproducibility if a seed is provided.

    Parameters:
    students (list of str): The students for whom the report is being generated.
    subjects (list of str): The subjects included in the report.
    seed (int, optional): A seed for the random number generator to ensure reproducibility. If None, the randomness is seeded by the system.

    Returns:
    DataFrame: A pandas DataFrame containing each student's grades across the subjects and their average grade. 
               Columns are ['Student', 'Subject1', 'Subject2', ..., 'Average Grade'].

    Requirements:
    - pandas
    - statistics
    - random

    Example:
    >>> students = ['Alice', 'Bob', 'Charlie']
    >>> subjects = ['Math', 'Physics', 'English']
    >>> report = task_func(students, subjects, seed=123)
    >>> print(report)
       Student  Math  Physics  English  Average Grade
    0    Alice     6       34       11      17.000000
    1      Bob    98       52       34      61.333333
    2  Charlie    13        4       48      21.666667
    """

instruct prompt

Create a grade report for a list of students across various subjects. Each student's grades are randomly generated, and the report includes the average grade for each student. The randomness is seeded for reproducibility if a seed is provided.
The function should output with:
    DataFrame: A pandas DataFrame containing each student's grades across the subjects and their average grade.
    Columns are ['Student', 'Subject1', 'Subject2', ..., 'Average Grade'].
You should write self-contained code starting with:

Code

import pandas as pd
import statistics
import random
def task_func(students, subjects, seed=None):

code prompt

Code

import pandas as pd
import statistics
import random
def task_func(students, subjects, seed=None):

entry point

task_func

libs

  • statistics
  • pandas
  • random

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