benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 7a925a1f-e11f-593c-a1d3-afc31df7a7b9

Problem

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

complete prompt

import psutil
import platform

def task_func():
    """
    Obtain system details, including operating system, architecture, and memory usage.
    
    This function gathers information about the system's operating system, architecture,
    and memory usage. It calculates the percentage of used memory  by comparing the total
    and currently used memory. The gathered details are then returned in a dictionary 
    format with specific keys for each piece of information.
    
    Returns:
    dict: A dictionary containing:
        - 'OS': Operating System name (e.g., 'Windows', 'Linux').
        - 'Architecture': System architecture (typically first item from platform.architecture(), e.g., '64bit').
        - 'Memory Usage': Formatted string representing the percentage of memory currently in use, 
                            calculated as (used memory / total memory) * 100.
  
    Requirements:
    - platform
    - psutil

    Examples:
    >>> system_info = task_func()
    >>> isinstance(system_info, dict)
    True
    >>> 'OS' in system_info
    True
    >>> 'Architecture' in system_info
    True
    >>> 'Memory Usage' in system_info
    True
    """

instruct prompt

Obtain system details, including operating system, architecture, and memory usage. This function gathers information about the system's operating system, architecture, and memory usage. It calculates the percentage of used memory  by comparing the total and currently used memory. The gathered details are then returned in a dictionary format with specific keys for each piece of information.
The function should output with:
    dict: A dictionary containing:
    'OS': Operating System name (e.g., 'Windows', 'Linux').
    'Architecture': System architecture (typically first item from platform.architecture(), e.g., '64bit').
    'Memory Usage': Formatted string representing the percentage of memory currently in use,
    calculated as (used memory / total memory) * 100.
You should write self-contained code starting with:

Code

import psutil
import platform
def task_func():

code prompt

Code

import psutil
import platform
def task_func():

entry point

task_func

libs

  • psutil
  • platform

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