Write a programming task in the following format: "Title": "[Название…
- User
Assistant: User: Write a programming task in the following format:
"Title": "[Название задачи]", "Task Description": "[Краткое описание задачи, что требуется сделать]", "Function Signature": "def имя функции -> [тип возвращаемого значения]:"
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]"
Provide three examples of input and output in the following format: "Examples": "Input: [Пример входных данных] Output: [Пример выходных данных]"
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": "def fahrenheit_to_celsius(fahrenheit: float): return (fahrenheit - 32) * 5 / 9", "Examples": "Input: 100 Output: 37.78, Input: 32 Output: 0, Input: 212 Output: 100"
Please follow this format exactly, without any additional explanations or comments.
Assistant:
- Assistant
"Title": "Calculate Factorial Recursively", "Task Description": "Write a function that calculates the factorial of a given non-negative integer n using recursion.", "Function Signature": "def factorial(n: int) -> int:", "Solve": "def factorial(n: int): return 1 if n == 0 else n * factorial(n - 1)", "Examples": "Input: 5 Output: 120, Input: 0 Output: 1, Input: 3 Output: 6"
"Title": "Check Palindrome String", "Task Description": "Write a function that checks if a given string is a palindrome.", "Function Signature": "def is_palindrome(s: str) -> bool:", "Solve": "def is_palindrome(s: str): return s == s[::-1]", "Examples": "Input: 'racecar' Output: True, Input: 'hello' Output: False, Input: 'madam' Output: True"
"Title": "Find Maximum Element in a List", "Task Description": "Write a function that finds the maximum element in a list of integers.", "Function Signature": "def find_max(lst: list) -> int:", "Solve": "def find_max(lst: list): return max(lst)", "Examples": "Input: [3, 1, 4, 1, 5, 9] Output: 9, Input: [-1, -5, -3] Output: -1, Input: [10, 20, 30] Output: 30"
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.