Dataset Viewer
Auto-converted to Parquet Duplicate
prompt
listlengths
1
1
chosen
listlengths
2
2
rejected
listlengths
2
2
i
int64
0
50k
[ { "content": "Given a positive integer n (1 ≤ n ≤ 1,000,000), write a Python function with the signature:\n\ndef collatz_steps(n: int) -> int:\n '''Returns the number of Collatz operations required to reach 1 from n.'''\n\nApply the following Collatz operations repeatedly:\n- If n is even, divide by 2.\n- If...
[ { "content": "Given a positive integer n (1 ≤ n ≤ 1,000,000), write a Python function with the signature:\n\ndef collatz_steps(n: int) -> int:\n '''Returns the number of Collatz operations required to reach 1 from n.'''\n\nApply the following Collatz operations repeatedly:\n- If n is even, divide by 2.\n- If...
[ { "content": "Given a positive integer n (1 ≤ n ≤ 1,000,000), write a Python function with the signature:\n\ndef collatz_steps(n: int) -> int:\n '''Returns the number of Collatz operations required to reach 1 from n.'''\n\nApply the following Collatz operations repeatedly:\n- If n is even, divide by 2.\n- If...
5,040
[ { "content": "Given a positive integer n (1 ≤ n ≤ 1,000,000), write a Python function with the signature:\n\ndef collatz_steps(n: int) -> int:\n '''Returns the number of Collatz operations required to reach 1 from n.'''\n\nApply the following Collatz operations repeatedly:\n- If n is even, divide by 2.\n- If...
[ { "content": "Given a positive integer n (1 ≤ n ≤ 1,000,000), write a Python function with the signature:\n\ndef collatz_steps(n: int) -> int:\n '''Returns the number of Collatz operations required to reach 1 from n.'''\n\nApply the following Collatz operations repeatedly:\n- If n is even, divide by 2.\n- If...
[ { "content": "Given a positive integer n (1 ≤ n ≤ 1,000,000), write a Python function with the signature:\n\ndef collatz_steps(n: int) -> int:\n '''Returns the number of Collatz operations required to reach 1 from n.'''\n\nApply the following Collatz operations repeatedly:\n- If n is even, divide by 2.\n- If...
5,040
[ { "content": "Define a function called `greet` that takes no parameters and returns a greeting message 'Hello, World!'.", "role": "user" } ]
[ { "content": "Define a function called `greet` that takes no parameters and returns a greeting message 'Hello, World!'.", "role": "user" }, { "content": "Here's a simple implementation of the `greet` function in Python:\n```python\ndef greet():\n return 'Hello, World!'\n```\nThis function consume...
[ { "content": "Define a function called `greet` that takes no parameters and returns a greeting message 'Hello, World!'.", "role": "user" }, { "content": "Here's a simple function in Python that does exactly that:\n\n```python\ndef greet():\n print(\"Hello, World!\")\n```\n\nYou can call this func...
5,045
[ { "content": "Define a function called `greet` that takes no parameters and returns a greeting message 'Hello, World!'.", "role": "user" } ]
[ { "content": "Define a function called `greet` that takes no parameters and returns a greeting message 'Hello, World!'.", "role": "user" }, { "content": "Here's a simple implementation of the `greet` function:\n\n```python\ndef greet():\n return \"Hello, World!\"\n```", "role": "assistant" ...
[ { "content": "Define a function called `greet` that takes no parameters and returns a greeting message 'Hello, World!'.", "role": "user" }, { "content": "```python\ndef greet():\n \"This function returns a greeting message: 'Hello, World!'\"\n```", "role": "assistant" } ]
5,045
[ { "content": "You are tasked with implementing a simple caching mechanism for a function that retrieves the access control list (ACL) of a bucket in a cloud storage system. The function `get_bucket_acl` takes a string parameter `bucket_name` and returns a string that represents the ACL associated with that buck...
[ { "content": "You are tasked with implementing a simple caching mechanism for a function that retrieves the access control list (ACL) of a bucket in a cloud storage system. The function `get_bucket_acl` takes a string parameter `bucket_name` and returns a string that represents the ACL associated with that buck...
[ { "content": "You are tasked with implementing a simple caching mechanism for a function that retrieves the access control list (ACL) of a bucket in a cloud storage system. The function `get_bucket_acl` takes a string parameter `bucket_name` and returns a string that represents the ACL associated with that buck...
5,047
[ { "content": "You are tasked with implementing a simple caching mechanism for a function that retrieves the access control list (ACL) of a bucket in a cloud storage system. The function `get_bucket_acl` takes a string parameter `bucket_name` and returns a string that represents the ACL associated with that buck...
[ { "content": "You are tasked with implementing a simple caching mechanism for a function that retrieves the access control list (ACL) of a bucket in a cloud storage system. The function `get_bucket_acl` takes a string parameter `bucket_name` and returns a string that represents the ACL associated with that buck...
[ { "content": "You are tasked with implementing a simple caching mechanism for a function that retrieves the access control list (ACL) of a bucket in a cloud storage system. The function `get_bucket_acl` takes a string parameter `bucket_name` and returns a string that represents the ACL associated with that buck...
5,047
[ { "content": "Implement a function that performs an insertion sort on a list of integers. The function should take a list as an input and return a new list that contains the same integers sorted in ascending order.", "role": "user" } ]
[ { "content": "Implement a function that performs an insertion sort on a list of integers. The function should take a list as an input and return a new list that contains the same integers sorted in ascending order.", "role": "user" }, { "content": "Here's a Python implementation of the insertion sor...
[ { "content": "Implement a function that performs an insertion sort on a list of integers. The function should take a list as an input and return a new list that contains the same integers sorted in ascending order.", "role": "user" }, { "content": "To implement insertion sort, we will iterate throug...
5,048
[ { "content": "You are tasked with implementing a function to encode a given string of data using a simple encoding mechanism. The encoding mechanism is to reverse the string and then convert each character to its corresponding ASCII value, separated by commas. Implement a function called `encode_data` that take...
[ { "content": "You are tasked with implementing a function to encode a given string of data using a simple encoding mechanism. The encoding mechanism is to reverse the string and then convert each character to its corresponding ASCII value, separated by commas. Implement a function called `encode_data` that take...
[ { "content": "You are tasked with implementing a function to encode a given string of data using a simple encoding mechanism. The encoding mechanism is to reverse the string and then convert each character to its corresponding ASCII value, separated by commas. Implement a function called `encode_data` that take...
5,049
[ { "content": "You are tasked with implementing a function to encode a given string of data using a simple encoding mechanism. The encoding mechanism is to reverse the string and then convert each character to its corresponding ASCII value, separated by commas. Implement a function called `encode_data` that take...
[ { "content": "You are tasked with implementing a function to encode a given string of data using a simple encoding mechanism. The encoding mechanism is to reverse the string and then convert each character to its corresponding ASCII value, separated by commas. Implement a function called `encode_data` that take...
[ { "content": "You are tasked with implementing a function to encode a given string of data using a simple encoding mechanism. The encoding mechanism is to reverse the string and then convert each character to its corresponding ASCII value, separated by commas. Implement a function called `encode_data` that take...
5,049
[ { "content": "Write a function named simplify_claims that takes a list of dictionaries, where each dictionary has keys \"type\" (a string) and \"amount\" (a float), representing insurance claim entries. The function should return a dictionary where each key is a claim type and each value is the sum of all amoun...
[ { "content": "Write a function named simplify_claims that takes a list of dictionaries, where each dictionary has keys \"type\" (a string) and \"amount\" (a float), representing insurance claim entries. The function should return a dictionary where each key is a claim type and each value is the sum of all amoun...
[ { "content": "Write a function named simplify_claims that takes a list of dictionaries, where each dictionary has keys \"type\" (a string) and \"amount\" (a float), representing insurance claim entries. The function should return a dictionary where each key is a claim type and each value is the sum of all amoun...
5,052
[ { "content": "Write a function called `nth_power` that takes a list of numbers and an integer n as inputs, and returns a new list containing each number raised to the power of n. Your function should raise a ValueError if the input list contains any non-numeric values or if n is not an integer. Implement only t...
[ { "content": "Write a function called `nth_power` that takes a list of numbers and an integer n as inputs, and returns a new list containing each number raised to the power of n. Your function should raise a ValueError if the input list contains any non-numeric values or if n is not an integer. Implement only t...
[ { "content": "Write a function called `nth_power` that takes a list of numbers and an integer n as inputs, and returns a new list containing each number raised to the power of n. Your function should raise a ValueError if the input list contains any non-numeric values or if n is not an integer. Implement only t...
5,061
[ { "content": "Write a function called `nth_power` that takes a list of numbers and an integer n as inputs, and returns a new list containing each number raised to the power of n. Your function should raise a ValueError if the input list contains any non-numeric values or if n is not an integer. Implement only t...
[ { "content": "Write a function called `nth_power` that takes a list of numbers and an integer n as inputs, and returns a new list containing each number raised to the power of n. Your function should raise a ValueError if the input list contains any non-numeric values or if n is not an integer. Implement only t...
[ { "content": "Write a function called `nth_power` that takes a list of numbers and an integer n as inputs, and returns a new list containing each number raised to the power of n. Your function should raise a ValueError if the input list contains any non-numeric values or if n is not an integer. Implement only t...
5,061
[ { "content": "Write a function called is_palindrome(s) that determines if the given string s is a palindrome, ignoring spaces, capitalization, and punctuation. The function takes a single string s as input and returns True if s is a palindrome, and False otherwise.\n\nExamples:\n- is_palindrome(\"A man, a plan,...
[ { "content": "Write a function called is_palindrome(s) that determines if the given string s is a palindrome, ignoring spaces, capitalization, and punctuation. The function takes a single string s as input and returns True if s is a palindrome, and False otherwise.\n\nExamples:\n- is_palindrome(\"A man, a plan,...
[ { "content": "Write a function called is_palindrome(s) that determines if the given string s is a palindrome, ignoring spaces, capitalization, and punctuation. The function takes a single string s as input and returns True if s is a palindrome, and False otherwise.\n\nExamples:\n- is_palindrome(\"A man, a plan,...
5,062
[ { "content": "Write a function called is_palindrome(s) that determines if the given string s is a palindrome, ignoring spaces, capitalization, and punctuation. The function takes a single string s as input and returns True if s is a palindrome, and False otherwise.\n\nExamples:\n- is_palindrome(\"A man, a plan,...
[ { "content": "Write a function called is_palindrome(s) that determines if the given string s is a palindrome, ignoring spaces, capitalization, and punctuation. The function takes a single string s as input and returns True if s is a palindrome, and False otherwise.\n\nExamples:\n- is_palindrome(\"A man, a plan,...
[ { "content": "Write a function called is_palindrome(s) that determines if the given string s is a palindrome, ignoring spaces, capitalization, and punctuation. The function takes a single string s as input and returns True if s is a palindrome, and False otherwise.\n\nExamples:\n- is_palindrome(\"A man, a plan,...
5,062
[ { "content": "You are given a list of tuples `testdata`, where each tuple contains three integers `(a, b, c)`. Your task is to write a function `sum_of_pairs` that takes in the list of tuples and returns a new list containing the sum of the first two elements of each tuple. For example, given the `testdata` as ...
[ { "content": "You are given a list of tuples `testdata`, where each tuple contains three integers `(a, b, c)`. Your task is to write a function `sum_of_pairs` that takes in the list of tuples and returns a new list containing the sum of the first two elements of each tuple. For example, given the `testdata` as ...
[ { "content": "You are given a list of tuples `testdata`, where each tuple contains three integers `(a, b, c)`. Your task is to write a function `sum_of_pairs` that takes in the list of tuples and returns a new list containing the sum of the first two elements of each tuple. For example, given the `testdata` as ...
5,064
[ { "content": "You are given a list of tuples `testdata`, where each tuple contains three integers `(a, b, c)`. Your task is to write a function `sum_of_pairs` that takes in the list of tuples and returns a new list containing the sum of the first two elements of each tuple. For example, given the `testdata` as ...
[ { "content": "You are given a list of tuples `testdata`, where each tuple contains three integers `(a, b, c)`. Your task is to write a function `sum_of_pairs` that takes in the list of tuples and returns a new list containing the sum of the first two elements of each tuple. For example, given the `testdata` as ...
[ { "content": "You are given a list of tuples `testdata`, where each tuple contains three integers `(a, b, c)`. Your task is to write a function `sum_of_pairs` that takes in the list of tuples and returns a new list containing the sum of the first two elements of each tuple. For example, given the `testdata` as ...
5,064
[ { "content": "You are tasked with creating a function that generates a zip file name based on a given directory name. The function should take a directory name as an input and return a string that is the directory name appended with the extension '.zip'. Additionally, if the input directory name is empty, the f...
[ { "content": "You are tasked with creating a function that generates a zip file name based on a given directory name. The function should take a directory name as an input and return a string that is the directory name appended with the extension '.zip'. Additionally, if the input directory name is empty, the f...
[ { "content": "You are tasked with creating a function that generates a zip file name based on a given directory name. The function should take a directory name as an input and return a string that is the directory name appended with the extension '.zip'. Additionally, if the input directory name is empty, the f...
5,066
[ { "content": "You are tasked with creating a function that generates a zip file name based on a given directory name. The function should take a directory name as an input and return a string that is the directory name appended with the extension '.zip'. Additionally, if the input directory name is empty, the f...
[ { "content": "You are tasked with creating a function that generates a zip file name based on a given directory name. The function should take a directory name as an input and return a string that is the directory name appended with the extension '.zip'. Additionally, if the input directory name is empty, the f...
[ { "content": "You are tasked with creating a function that generates a zip file name based on a given directory name. The function should take a directory name as an input and return a string that is the directory name appended with the extension '.zip'. Additionally, if the input directory name is empty, the f...
5,066
[ { "content": "Implement a function `abs(num)` that takes a single parameter `num`, which can be an integer or a float. The function should return the absolute value of `num`, defined as its distance from zero on the number line, regardless of its sign. You are not allowed to use the built-in `abs` function in y...
[ { "content": "Implement a function `abs(num)` that takes a single parameter `num`, which can be an integer or a float. The function should return the absolute value of `num`, defined as its distance from zero on the number line, regardless of its sign. You are not allowed to use the built-in `abs` function in y...
[ { "content": "Implement a function `abs(num)` that takes a single parameter `num`, which can be an integer or a float. The function should return the absolute value of `num`, defined as its distance from zero on the number line, regardless of its sign. You are not allowed to use the built-in `abs` function in y...
5,067
[ { "content": "Implement a function `abs(num)` that takes a single parameter `num`, which can be an integer or a float. The function should return the absolute value of `num`, defined as its distance from zero on the number line, regardless of its sign. You are not allowed to use the built-in `abs` function in y...
[ { "content": "Implement a function `abs(num)` that takes a single parameter `num`, which can be an integer or a float. The function should return the absolute value of `num`, defined as its distance from zero on the number line, regardless of its sign. You are not allowed to use the built-in `abs` function in y...
[ { "content": "Implement a function `abs(num)` that takes a single parameter `num`, which can be an integer or a float. The function should return the absolute value of `num`, defined as its distance from zero on the number line, regardless of its sign. You are not allowed to use the built-in `abs` function in y...
5,067
[ { "content": "Write a Python function named `filter_stories_by_keyword` that takes two inputs: `stories`, a list of strings where each string is a story, and `keyword`, a string representing the keyword to search for. The function should return a list of stories that contain the specified keyword (case-insensit...
[ { "content": "Write a Python function named `filter_stories_by_keyword` that takes two inputs: `stories`, a list of strings where each string is a story, and `keyword`, a string representing the keyword to search for. The function should return a list of stories that contain the specified keyword (case-insensit...
[ { "content": "Write a Python function named `filter_stories_by_keyword` that takes two inputs: `stories`, a list of strings where each string is a story, and `keyword`, a string representing the keyword to search for. The function should return a list of stories that contain the specified keyword (case-insensit...
5,069
[ { "content": "Write a Python function named `filter_stories_by_keyword` that takes two inputs: `stories`, a list of strings where each string is a story, and `keyword`, a string representing the keyword to search for. The function should return a list of stories that contain the specified keyword (case-insensit...
[ { "content": "Write a Python function named `filter_stories_by_keyword` that takes two inputs: `stories`, a list of strings where each string is a story, and `keyword`, a string representing the keyword to search for. The function should return a list of stories that contain the specified keyword (case-insensit...
[ { "content": "Write a Python function named `filter_stories_by_keyword` that takes two inputs: `stories`, a list of strings where each string is a story, and `keyword`, a string representing the keyword to search for. The function should return a list of stories that contain the specified keyword (case-insensit...
5,069
[ { "content": "Write a Python function `calculate_total_meetings(meetings)` that takes a list of dictionaries as input, where each dictionary contains the keys \"day\" (a string for day of the week) and \"count\" (an integer number of meetings that day). The function should return an integer representing the tot...
[ { "content": "Write a Python function `calculate_total_meetings(meetings)` that takes a list of dictionaries as input, where each dictionary contains the keys \"day\" (a string for day of the week) and \"count\" (an integer number of meetings that day). The function should return an integer representing the tot...
[ { "content": "Write a Python function `calculate_total_meetings(meetings)` that takes a list of dictionaries as input, where each dictionary contains the keys \"day\" (a string for day of the week) and \"count\" (an integer number of meetings that day). The function should return an integer representing the tot...
5,070
[ { "content": "Write a Python function `calculate_total_meetings(meetings)` that takes a list of dictionaries as input, where each dictionary contains the keys \"day\" (a string for day of the week) and \"count\" (an integer number of meetings that day). The function should return an integer representing the tot...
[ { "content": "Write a Python function `calculate_total_meetings(meetings)` that takes a list of dictionaries as input, where each dictionary contains the keys \"day\" (a string for day of the week) and \"count\" (an integer number of meetings that day). The function should return an integer representing the tot...
[ { "content": "Write a Python function `calculate_total_meetings(meetings)` that takes a list of dictionaries as input, where each dictionary contains the keys \"day\" (a string for day of the week) and \"count\" (an integer number of meetings that day). The function should return an integer representing the tot...
5,070
[ { "content": "Implement a function validParentheses(s: str) -> bool that takes a single string argument s, consisting of parentheses characters '(', ')', '{', '}', '[' and ']'. The function should return True if the parentheses in s are valid, and False otherwise. Parentheses are valid if every opening bracket ...
[ { "content": "Implement a function validParentheses(s: str) -> bool that takes a single string argument s, consisting of parentheses characters '(', ')', '{', '}', '[' and ']'. The function should return True if the parentheses in s are valid, and False otherwise. Parentheses are valid if every opening bracket ...
[ { "content": "Implement a function validParentheses(s: str) -> bool that takes a single string argument s, consisting of parentheses characters '(', ')', '{', '}', '[' and ']'. The function should return True if the parentheses in s are valid, and False otherwise. Parentheses are valid if every opening bracket ...
5,071
[ { "content": "Implement a function validParentheses(s: str) -> bool that takes a single string argument s, consisting of parentheses characters '(', ')', '{', '}', '[' and ']'. The function should return True if the parentheses in s are valid, and False otherwise. Parentheses are valid if every opening bracket ...
[ { "content": "Implement a function validParentheses(s: str) -> bool that takes a single string argument s, consisting of parentheses characters '(', ')', '{', '}', '[' and ']'. The function should return True if the parentheses in s are valid, and False otherwise. Parentheses are valid if every opening bracket ...
[ { "content": "Implement a function validParentheses(s: str) -> bool that takes a single string argument s, consisting of parentheses characters '(', ')', '{', '}', '[' and ']'. The function should return True if the parentheses in s are valid, and False otherwise. Parentheses are valid if every opening bracket ...
5,071
[ { "content": "You are given a string `policy_type_id` that represents a policy type ID in the format 'storage-policy-XXXXXX', where 'XXXXXX' is a sequence of digits. Your task is to implement a function that verifies whether the given policy type ID is valid. A valid policy type ID starts with 'storage-policy-'...
[ { "content": "You are given a string `policy_type_id` that represents a policy type ID in the format 'storage-policy-XXXXXX', where 'XXXXXX' is a sequence of digits. Your task is to implement a function that verifies whether the given policy type ID is valid. A valid policy type ID starts with 'storage-policy-'...
[ { "content": "You are given a string `policy_type_id` that represents a policy type ID in the format 'storage-policy-XXXXXX', where 'XXXXXX' is a sequence of digits. Your task is to implement a function that verifies whether the given policy type ID is valid. A valid policy type ID starts with 'storage-policy-'...
5,073
[ { "content": "You are given a string `policy_type_id` that represents a policy type ID in the format 'storage-policy-XXXXXX', where 'XXXXXX' is a sequence of digits. Your task is to implement a function that verifies whether the given policy type ID is valid. A valid policy type ID starts with 'storage-policy-'...
[ { "content": "You are given a string `policy_type_id` that represents a policy type ID in the format 'storage-policy-XXXXXX', where 'XXXXXX' is a sequence of digits. Your task is to implement a function that verifies whether the given policy type ID is valid. A valid policy type ID starts with 'storage-policy-'...
[ { "content": "You are given a string `policy_type_id` that represents a policy type ID in the format 'storage-policy-XXXXXX', where 'XXXXXX' is a sequence of digits. Your task is to implement a function that verifies whether the given policy type ID is valid. A valid policy type ID starts with 'storage-policy-'...
5,073
[ { "content": "Given a list of dictionaries, each representing a ratio with fields 'path', 'ratio', and 'url', create a function that extracts the 'ratio' values into a new list. The input list will contain at least one dictionary and at most 1000 dictionaries. The function should return the list of ratios as st...
[ { "content": "Given a list of dictionaries, each representing a ratio with fields 'path', 'ratio', and 'url', create a function that extracts the 'ratio' values into a new list. The input list will contain at least one dictionary and at most 1000 dictionaries. The function should return the list of ratios as st...
[ { "content": "Given a list of dictionaries, each representing a ratio with fields 'path', 'ratio', and 'url', create a function that extracts the 'ratio' values into a new list. The input list will contain at least one dictionary and at most 1000 dictionaries. The function should return the list of ratios as st...
5,074
[ { "content": "Define a function named `calculate_cars_coated` that takes two arguments:\n- `total_formula_volume` (float): The total ceramic coating formula available in liters.\n- `volume_per_car` (float): The volume of coating needed for one car in liters.\n\nThe function should return the maximum integer num...
[ { "content": "Define a function named `calculate_cars_coated` that takes two arguments:\n- `total_formula_volume` (float): The total ceramic coating formula available in liters.\n- `volume_per_car` (float): The volume of coating needed for one car in liters.\n\nThe function should return the maximum integer num...
[ { "content": "Define a function named `calculate_cars_coated` that takes two arguments:\n- `total_formula_volume` (float): The total ceramic coating formula available in liters.\n- `volume_per_car` (float): The volume of coating needed for one car in liters.\n\nThe function should return the maximum integer num...
5,080
[ { "content": "Define a function named `calculate_cars_coated` that takes two arguments:\n- `total_formula_volume` (float): The total ceramic coating formula available in liters.\n- `volume_per_car` (float): The volume of coating needed for one car in liters.\n\nThe function should return the maximum integer num...
[ { "content": "Define a function named `calculate_cars_coated` that takes two arguments:\n- `total_formula_volume` (float): The total ceramic coating formula available in liters.\n- `volume_per_car` (float): The volume of coating needed for one car in liters.\n\nThe function should return the maximum integer num...
[ { "content": "Define a function named `calculate_cars_coated` that takes two arguments:\n- `total_formula_volume` (float): The total ceramic coating formula available in liters.\n- `volume_per_car` (float): The volume of coating needed for one car in liters.\n\nThe function should return the maximum integer num...
5,080
[ { "content": "Write a function `calculate_expected_profit(pairs)` that takes a list of tuples representing animal breeding pairs. Each tuple should contain the name of the pair (string), the potential profit (float), and the probability of successful breeding (float between 0 and 1). The function should return ...
[ { "content": "Write a function `calculate_expected_profit(pairs)` that takes a list of tuples representing animal breeding pairs. Each tuple should contain the name of the pair (string), the potential profit (float), and the probability of successful breeding (float between 0 and 1). The function should return ...
[ { "content": "Write a function `calculate_expected_profit(pairs)` that takes a list of tuples representing animal breeding pairs. Each tuple should contain the name of the pair (string), the potential profit (float), and the probability of successful breeding (float between 0 and 1). The function should return ...
5,091
[ { "content": "Write a function `calculate_expected_profit(pairs)` that takes a list of tuples representing animal breeding pairs. Each tuple should contain the name of the pair (string), the potential profit (float), and the probability of successful breeding (float between 0 and 1). The function should return ...
[ { "content": "Write a function `calculate_expected_profit(pairs)` that takes a list of tuples representing animal breeding pairs. Each tuple should contain the name of the pair (string), the potential profit (float), and the probability of successful breeding (float between 0 and 1). The function should return ...
[ { "content": "Write a function `calculate_expected_profit(pairs)` that takes a list of tuples representing animal breeding pairs. Each tuple should contain the name of the pair (string), the potential profit (float), and the probability of successful breeding (float between 0 and 1). The function should return ...
5,091
[ { "content": "You are tasked with creating a Python function that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your function should take a single para...
[ { "content": "You are tasked with creating a Python function that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your function should take a single para...
[ { "content": "You are tasked with creating a Python function that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your function should take a single para...
5,092
[ { "content": "You are tasked with creating a Python function that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your function should take a single para...
[ { "content": "You are tasked with creating a Python function that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your function should take a single para...
[ { "content": "You are tasked with creating a Python function that checks if a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward (ignoring spaces, punctuation, and capitalization). Your function should take a single para...
5,092
[ { "content": "Write a Python function named identify_genes_above_threshold that takes two parameters: genes (a list of tuples, each containing a gene name as a string and its expression level as a float) and threshold (a float specifying the expression level cutoff). The function should return a list of gene na...
[ { "content": "Write a Python function named identify_genes_above_threshold that takes two parameters: genes (a list of tuples, each containing a gene name as a string and its expression level as a float) and threshold (a float specifying the expression level cutoff). The function should return a list of gene na...
[ { "content": "Write a Python function named identify_genes_above_threshold that takes two parameters: genes (a list of tuples, each containing a gene name as a string and its expression level as a float) and threshold (a float specifying the expression level cutoff). The function should return a list of gene na...
5,093
[ { "content": "Write a Python function named identify_genes_above_threshold that takes two parameters: genes (a list of tuples, each containing a gene name as a string and its expression level as a float) and threshold (a float specifying the expression level cutoff). The function should return a list of gene na...
[ { "content": "Write a Python function named identify_genes_above_threshold that takes two parameters: genes (a list of tuples, each containing a gene name as a string and its expression level as a float) and threshold (a float specifying the expression level cutoff). The function should return a list of gene na...
[ { "content": "Write a Python function named identify_genes_above_threshold that takes two parameters: genes (a list of tuples, each containing a gene name as a string and its expression level as a float) and threshold (a float specifying the expression level cutoff). The function should return a list of gene na...
5,093
[ { "content": "Write a function called parse_scores that takes a single parameter scores_str, which is a string containing the scores of a series of Clippers games in the format \"Clippers1-Opponent1,Clippers2-Opponent2,...\". Each game is separated by a comma, and each score is represented as two numbers separa...
[ { "content": "Write a function called parse_scores that takes a single parameter scores_str, which is a string containing the scores of a series of Clippers games in the format \"Clippers1-Opponent1,Clippers2-Opponent2,...\". Each game is separated by a comma, and each score is represented as two numbers separa...
[ { "content": "Write a function called parse_scores that takes a single parameter scores_str, which is a string containing the scores of a series of Clippers games in the format \"Clippers1-Opponent1,Clippers2-Opponent2,...\". Each game is separated by a comma, and each score is represented as two numbers separa...
5,099
[ { "content": "Write a function called parse_scores that takes a single parameter scores_str, which is a string containing the scores of a series of Clippers games in the format \"Clippers1-Opponent1,Clippers2-Opponent2,...\". Each game is separated by a comma, and each score is represented as two numbers separa...
[ { "content": "Write a function called parse_scores that takes a single parameter scores_str, which is a string containing the scores of a series of Clippers games in the format \"Clippers1-Opponent1,Clippers2-Opponent2,...\". Each game is separated by a comma, and each score is represented as two numbers separa...
[ { "content": "Write a function called parse_scores that takes a single parameter scores_str, which is a string containing the scores of a series of Clippers games in the format \"Clippers1-Opponent1,Clippers2-Opponent2,...\". Each game is separated by a comma, and each score is represented as two numbers separa...
5,099
[ { "content": "Write a function called count_domain_visits that takes a list of website visit records as input and returns a dictionary mapping each domain name to the total number of visits. Each element of the input list is a string formatted as \"domain_name visit_count\" where visit_count is an integer.\n\nF...
[ { "content": "Write a function called count_domain_visits that takes a list of website visit records as input and returns a dictionary mapping each domain name to the total number of visits. Each element of the input list is a string formatted as \"domain_name visit_count\" where visit_count is an integer.\n\nF...
[ { "content": "Write a function called count_domain_visits that takes a list of website visit records as input and returns a dictionary mapping each domain name to the total number of visits. Each element of the input list is a string formatted as \"domain_name visit_count\" where visit_count is an integer.\n\nF...
5,101
[ { "content": "Write a function called count_domain_visits that takes a list of website visit records as input and returns a dictionary mapping each domain name to the total number of visits. Each element of the input list is a string formatted as \"domain_name visit_count\" where visit_count is an integer.\n\nF...
[ { "content": "Write a function called count_domain_visits that takes a list of website visit records as input and returns a dictionary mapping each domain name to the total number of visits. Each element of the input list is a string formatted as \"domain_name visit_count\" where visit_count is an integer.\n\nF...
[ { "content": "Write a function called count_domain_visits that takes a list of website visit records as input and returns a dictionary mapping each domain name to the total number of visits. Each element of the input list is a string formatted as \"domain_name visit_count\" where visit_count is an integer.\n\nF...
5,101
[ { "content": "Implement a function in Python with the signature 'def contains_duplicate(s: str) -> bool' that determines if a given string contains any duplicate characters. The input string s will only contain lowercase letters. For example, contains_duplicate('hello') should return True, and contains_duplicat...
[ { "content": "Implement a function in Python with the signature 'def contains_duplicate(s: str) -> bool' that determines if a given string contains any duplicate characters. The input string s will only contain lowercase letters. For example, contains_duplicate('hello') should return True, and contains_duplicat...
[ { "content": "Implement a function in Python with the signature 'def contains_duplicate(s: str) -> bool' that determines if a given string contains any duplicate characters. The input string s will only contain lowercase letters. For example, contains_duplicate('hello') should return True, and contains_duplicat...
5,106
[ { "content": "Implement a function in Python with the signature 'def contains_duplicate(s: str) -> bool' that determines if a given string contains any duplicate characters. The input string s will only contain lowercase letters. For example, contains_duplicate('hello') should return True, and contains_duplicat...
[ { "content": "Implement a function in Python with the signature 'def contains_duplicate(s: str) -> bool' that determines if a given string contains any duplicate characters. The input string s will only contain lowercase letters. For example, contains_duplicate('hello') should return True, and contains_duplicat...
[ { "content": "Implement a function in Python with the signature 'def contains_duplicate(s: str) -> bool' that determines if a given string contains any duplicate characters. The input string s will only contain lowercase letters. For example, contains_duplicate('hello') should return True, and contains_duplicat...
5,106
[ { "content": "Write a Python function named `square_odd_integers` that takes a list of integers `lst` as input and returns a new list where each odd integer is replaced by its square, while even integers remain unchanged. The function should also correctly process negative integers. For example, `square_odd_int...
[ { "content": "Write a Python function named `square_odd_integers` that takes a list of integers `lst` as input and returns a new list where each odd integer is replaced by its square, while even integers remain unchanged. The function should also correctly process negative integers. For example, `square_odd_int...
[ { "content": "Write a Python function named `square_odd_integers` that takes a list of integers `lst` as input and returns a new list where each odd integer is replaced by its square, while even integers remain unchanged. The function should also correctly process negative integers. For example, `square_odd_int...
5,109
[ { "content": "You are given a list of tuples, where each tuple contains a key (an integer) and a value (a floating-point number). Your task is to implement a function that selects all tuples from the list where the key matches a given integer and the value is equal to a specified floating-point number. Return a...
[ { "content": "You are given a list of tuples, where each tuple contains a key (an integer) and a value (a floating-point number). Your task is to implement a function that selects all tuples from the list where the key matches a given integer and the value is equal to a specified floating-point number. Return a...
[ { "content": "You are given a list of tuples, where each tuple contains a key (an integer) and a value (a floating-point number). Your task is to implement a function that selects all tuples from the list where the key matches a given integer and the value is equal to a specified floating-point number. Return a...
5,110
[ { "content": "You are given a list of tuples, where each tuple contains a key (an integer) and a value (a floating-point number). Your task is to implement a function that selects all tuples from the list where the key matches a given integer and the value is equal to a specified floating-point number. Return a...
[ { "content": "You are given a list of tuples, where each tuple contains a key (an integer) and a value (a floating-point number). Your task is to implement a function that selects all tuples from the list where the key matches a given integer and the value is equal to a specified floating-point number. Return a...
[ { "content": "You are given a list of tuples, where each tuple contains a key (an integer) and a value (a floating-point number). Your task is to implement a function that selects all tuples from the list where the key matches a given integer and the value is equal to a specified floating-point number. Return a...
5,110
[ { "content": "You are given an integer array A and an integer K. Write a function with the following signature:\n\ndef pair_sum_exists(A: list[int], K: int) -> str\n\nThe function should return \"YES\" (without quotes) if there exist two different elements at different positions in the array A whose sum is exac...
[ { "content": "You are given an integer array A and an integer K. Write a function with the following signature:\n\ndef pair_sum_exists(A: list[int], K: int) -> str\n\nThe function should return \"YES\" (without quotes) if there exist two different elements at different positions in the array A whose sum is exac...
[ { "content": "You are given an integer array A and an integer K. Write a function with the following signature:\n\ndef pair_sum_exists(A: list[int], K: int) -> str\n\nThe function should return \"YES\" (without quotes) if there exist two different elements at different positions in the array A whose sum is exac...
5,117
[ { "content": "You are given an integer array A and an integer K. Write a function with the following signature:\n\ndef pair_sum_exists(A: list[int], K: int) -> str\n\nThe function should return \"YES\" (without quotes) if there exist two different elements at different positions in the array A whose sum is exac...
[ { "content": "You are given an integer array A and an integer K. Write a function with the following signature:\n\ndef pair_sum_exists(A: list[int], K: int) -> str\n\nThe function should return \"YES\" (without quotes) if there exist two different elements at different positions in the array A whose sum is exac...
[ { "content": "You are given an integer array A and an integer K. Write a function with the following signature:\n\ndef pair_sum_exists(A: list[int], K: int) -> str\n\nThe function should return \"YES\" (without quotes) if there exist two different elements at different positions in the array A whose sum is exac...
5,117
[ { "content": "Implement a Python function with the following signature: sort_list_of_dicts(lst, key). The function should take a list of dictionaries lst and a key string key, and return the list sorted by the values associated with key in ascending order.\n\nExample:\nInput: lst = [{'name': 'John', 'age': 23},...
[ { "content": "Implement a Python function with the following signature: sort_list_of_dicts(lst, key). The function should take a list of dictionaries lst and a key string key, and return the list sorted by the values associated with key in ascending order.\n\nExample:\nInput: lst = [{'name': 'John', 'age': 23},...
[ { "content": "Implement a Python function with the following signature: sort_list_of_dicts(lst, key). The function should take a list of dictionaries lst and a key string key, and return the list sorted by the values associated with key in ascending order.\n\nExample:\nInput: lst = [{'name': 'John', 'age': 23},...
5,118
[ { "content": "Implement a Python function with the following signature: sort_list_of_dicts(lst, key). The function should take a list of dictionaries lst and a key string key, and return the list sorted by the values associated with key in ascending order.\n\nExample:\nInput: lst = [{'name': 'John', 'age': 23},...
[ { "content": "Implement a Python function with the following signature: sort_list_of_dicts(lst, key). The function should take a list of dictionaries lst and a key string key, and return the list sorted by the values associated with key in ascending order.\n\nExample:\nInput: lst = [{'name': 'John', 'age': 23},...
[ { "content": "Implement a Python function with the following signature: sort_list_of_dicts(lst, key). The function should take a list of dictionaries lst and a key string key, and return the list sorted by the values associated with key in ascending order.\n\nExample:\nInput: lst = [{'name': 'John', 'age': 23},...
5,118
[ { "content": "Write a function named organize_records that takes a list of dictionaries representing vinyl records. Each dictionary contains the keys 'title', 'artist', and 'year'. The function should return a new list sorted first by 'year' (ascending), then by 'artist' name (alphabetically), and for identical...
[ { "content": "Write a function named organize_records that takes a list of dictionaries representing vinyl records. Each dictionary contains the keys 'title', 'artist', and 'year'. The function should return a new list sorted first by 'year' (ascending), then by 'artist' name (alphabetically), and for identical...
[ { "content": "Write a function named organize_records that takes a list of dictionaries representing vinyl records. Each dictionary contains the keys 'title', 'artist', and 'year'. The function should return a new list sorted first by 'year' (ascending), then by 'artist' name (alphabetically), and for identical...
5,119
[ { "content": "Write a function named organize_records that takes a list of dictionaries representing vinyl records. Each dictionary contains the keys 'title', 'artist', and 'year'. The function should return a new list sorted first by 'year' (ascending), then by 'artist' name (alphabetically), and for identical...
[ { "content": "Write a function named organize_records that takes a list of dictionaries representing vinyl records. Each dictionary contains the keys 'title', 'artist', and 'year'. The function should return a new list sorted first by 'year' (ascending), then by 'artist' name (alphabetically), and for identical...
[ { "content": "Write a function named organize_records that takes a list of dictionaries representing vinyl records. Each dictionary contains the keys 'title', 'artist', and 'year'. The function should return a new list sorted first by 'year' (ascending), then by 'artist' name (alphabetically), and for identical...
5,119
[ { "content": "Given two integers a and b, return the result of a mod b (i.e., the remainder when a is divided by b). Implement a function mystery_mod(a: int, b: int) -> int. For example, mystery_mod(5, 5) should return 0, and mystery_mod(6, 5) should return 1.", "role": "user" } ]
[ { "content": "Given two integers a and b, return the result of a mod b (i.e., the remainder when a is divided by b). Implement a function mystery_mod(a: int, b: int) -> int. For example, mystery_mod(5, 5) should return 0, and mystery_mod(6, 5) should return 1.", "role": "user" }, { "content": "Here'...
[ { "content": "Given two integers a and b, return the result of a mod b (i.e., the remainder when a is divided by b). Implement a function mystery_mod(a: int, b: int) -> int. For example, mystery_mod(5, 5) should return 0, and mystery_mod(6, 5) should return 1.", "role": "user" }, { "content": "To so...
5,121
[ { "content": "Given two integers a and b, return the result of a mod b (i.e., the remainder when a is divided by b). Implement a function mystery_mod(a: int, b: int) -> int. For example, mystery_mod(5, 5) should return 0, and mystery_mod(6, 5) should return 1.", "role": "user" } ]
[ { "content": "Given two integers a and b, return the result of a mod b (i.e., the remainder when a is divided by b). Implement a function mystery_mod(a: int, b: int) -> int. For example, mystery_mod(5, 5) should return 0, and mystery_mod(6, 5) should return 1.", "role": "user" }, { "content": "Here'...
[ { "content": "Given two integers a and b, return the result of a mod b (i.e., the remainder when a is divided by b). Implement a function mystery_mod(a: int, b: int) -> int. For example, mystery_mod(5, 5) should return 0, and mystery_mod(6, 5) should return 1.", "role": "user" }, { "content": "Here'...
5,121
[ { "content": "You are tasked with implementing a simple logging functionality in Python. Your goal is to create a function `logger_system(verbosity: str, msg: str) -> str` that simulates logging messages based on the given verbosity level. The function should take two parameters: a string `verbosity` which can ...
[ { "content": "You are tasked with implementing a simple logging functionality in Python. Your goal is to create a function `logger_system(verbosity: str, msg: str) -> str` that simulates logging messages based on the given verbosity level. The function should take two parameters: a string `verbosity` which can ...
[ { "content": "You are tasked with implementing a simple logging functionality in Python. Your goal is to create a function `logger_system(verbosity: str, msg: str) -> str` that simulates logging messages based on the given verbosity level. The function should take two parameters: a string `verbosity` which can ...
5,125
[ { "content": "You are tasked with implementing a simple logging functionality in Python. Your goal is to create a function `logger_system(verbosity: str, msg: str) -> str` that simulates logging messages based on the given verbosity level. The function should take two parameters: a string `verbosity` which can ...
[ { "content": "You are tasked with implementing a simple logging functionality in Python. Your goal is to create a function `logger_system(verbosity: str, msg: str) -> str` that simulates logging messages based on the given verbosity level. The function should take two parameters: a string `verbosity` which can ...
[ { "content": "You are tasked with implementing a simple logging functionality in Python. Your goal is to create a function `logger_system(verbosity: str, msg: str) -> str` that simulates logging messages based on the given verbosity level. The function should take two parameters: a string `verbosity` which can ...
5,125
[ { "content": "Write a function called calculate_average_sensor_reading that takes a list of sensor readings as input. Each reading is a dictionary with keys \"sensor_id\", \"timestamp\", and \"value\" (a float). The function should return a float representing the average of the \"value\" entries across all dict...
[ { "content": "Write a function called calculate_average_sensor_reading that takes a list of sensor readings as input. Each reading is a dictionary with keys \"sensor_id\", \"timestamp\", and \"value\" (a float). The function should return a float representing the average of the \"value\" entries across all dict...
[ { "content": "Write a function called calculate_average_sensor_reading that takes a list of sensor readings as input. Each reading is a dictionary with keys \"sensor_id\", \"timestamp\", and \"value\" (a float). The function should return a float representing the average of the \"value\" entries across all dict...
5,130
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
4