Write a programming task in the following format: "Title": "[Task…
- User
Assistant: User: Write a programming task in the following format:
"Title": "[Task title]", "Task Description": "[Brief description of the task, what needs to be done]", "Function Signature": "def function name -> [return type]:"
Please make sure to only provide the title, task description, and function signature, without examples, constraints, or detailed explanations.
Also, provide a solution for the task in Python code in the following format:
"Solve": "```python [Solution to the task in Python]
For example: "Title": "Convert Fahrenheit to Celsius", "Task Description": "Write a function that converts a given temperature from Fahrenheit to Celsius.", "Function Signature": "def fahrenheit_to_celsius(fahrenheit: float) -> float:", "Solve": "```python def fahrenheit_to_celsius(fahrenheit: float) -> float: return (fahrenheit - 32) * 5 / 9 ```" Please follow this format exactly, without any additional explanations or comments. Assistant: - Assistant
"Title": "Calculate Factorial", "Task Description": "Write a function that calculates the factorial of a given non-negative integer.", "Function Signature": "def factorial(n: int) -> int:", "Solve": "```python def factorial(n: int) -> int: if n == 0: return 1 result = 1 for i in range(1, n + 1): result *= i return result
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.