benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 2301f31e-9d7f-5992-8cdb-694d467915b2
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
def task_func():
"""
Creates and displays a diagram of a parabola represented by the equation y = x^2.
The function plots the parabola using matplotlib, sets the title as 'y = x^2', labels the axes as 'x' and 'y',
and enables the grid. It uses a fixed range for x values from -10 to 10 with 400 points.
This function is used for demonstrating basic plotting capabilities and visualizing
quadratic functions. The function does not take any parameters and does not return any value.
Requirements:
- numpy
- matplotlib.pyplot
Parameters:
None
Returns:
None
Examples:
>>> task_func() # This will display the plot of the parabola y = x^2
>>> type(task_func())
<class 'NoneType'>
"""
instruct prompt
Creates and displays a diagram of a parabola represented by the equation y = x^2. The function plots the parabola using matplotlib, sets the title as 'y = x^2', labels the axes as 'x' and 'y', and enables the grid. It uses a fixed range for x values from -10 to 10 with 400 points. This function is used for demonstrating basic plotting capabilities and visualizing quadratic functions. The function does not take any parameters and does not return any value.
The function should output with:
None
You should write self-contained code starting with:
Code
import numpy as np
import matplotlib.pyplot as plt
def task_func():
code prompt
Code
import numpy as np
import matplotlib.pyplot as plt
def task_func():
entry point
task_func
libs
- numpy
- matplotlib
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
initial import