source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
evol_instruct_66k
3,828
Write a Python function to identify the presence of negative integers within a collection of numerical values, determine the index position of the first negative integer, count the total number of negative integers present, and form a new collection consisting only of the negative integers while maintaining their origi...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_negatives(numbers: List[int]) -> Tuple[int, int, int, List[int]]: """ Identifies the presence of negative integers within a collection of numerical values, determines the index positi...
evol_instruct_66k
3,836
Write a Python function to generate the first `n` numbers in the Fibonacci sequence. The function should return a list containing the Fibonacci numbers. The code should start with: ```python from typing import List def generate_fibonacci(n: int) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_fibonacci(n: int) -> List[int]: """ Generate the first n numbers in the Fibonacci sequence. Args: n (int): The number of Fibonacci numbers to generate. Returns: Lis...
evol_instruct_66k
3,838
Write a Python function to determine if the elements in a given numeric array form an ascending progression with unique elements. The array may contain negative numbers and integers. The function should return `True` if the array adheres to these conditions, otherwise `False`. The code should start with: ```python fro...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_ascending_progression(nums: List[int]) -> bool: """ Determines if the elements in the given numeric array form an ascending progression with unique elements. Args: nums (List[int]): T...
evol_instruct_66k
3,846
Write a Python function to compute the prefix sum of a given list of integers. The prefix sum of a list is a new list where each element at index `i` is the sum of all elements from the original list up to index `i` (inclusive). The function should modify the input list in place and return it. The code should start wi...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def prefix_sum(sequence: List[int]) -> List[int]: """ Computes the prefix sum of a given list of integers. The prefix sum of a list is a new list where each element at index `i` is the sum of all el...
evol_instruct_66k
3,875
Write a Python function to identify and return a list of characters in a given alphabet string. The function should handle both uppercase and lowercase alphabets. The code should start with: ```python from typing import List def get_characters_in_alphabet(alphabet: str) -> List[str]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def get_characters_in_alphabet(alphabet: str) -> List[str]: """ Returns a list of characters in the given alphabet string. Args: alphabet (str): The string containing the alphabet characters...
evol_instruct_66k
3,882
Write a Python function to create a dictionary where the keys are integers and the values are tuples containing different types of data. The function should accept a list of tuples, where each tuple contains an integer key and a tuple of values. The function should return the constructed dictionary. The code should st...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict, Any def create_dictionary(data: List[Tuple[int, Tuple[Any, ...]]]) -> Dict[int, Tuple[Any, ...]]: """ Creates a dictionary from a list of tuples, where each tuple contains an integer key an...
evol_instruct_66k
3,884
Write a Python function to extract the integer part of a given floating-point number, handling both positive and negative numbers. The function should return the largest integer that is less than or equal to the input number. The code should start with: ```python import math def extract_integer(number: float) -> int:...
Here is the Python code to solve the given problem in the markdown block: ```python import math def extract_integer(number: float) -> int: """ Extracts the integer part of a given floating-point number. This function uses the `math.floor` function to determine the largest integer that is less than or ...
evol_instruct_66k
3,886
Write a Python function to determine the most suitable data structure for storing multiple formats of information like a person's name (string), age (integer), pets (array), along with their medical history (linked list) and job history (queue or stack) in nested levels. The function should return a dictionary that rep...
Here is the Python code to solve the given problem in the markdown block: ```python from collections import deque def determine_data_structure() -> dict: """ Determines the most suitable data structure for storing multiple formats of information like a person's name (string), age (integer), pets (array), a...
evol_instruct_66k
3,892
Write a Python function to identify and replace each distinct non-alphanumeric character in a given alphanumeric string with a specified replacement character. The function should return the modified string. The code should start with: ```python def replace_non_alphanumeric(s: str, replacement: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def replace_non_alphanumeric(s: str, replacement: str) -> str: """ Replaces each distinct non-alphanumeric character in the given string with the specified replacement character. Args: s (str): The input string cont...
evol_instruct_66k
3,898
Write a Python function to construct a dictionary where the keys are tuples of integers, and the values are lists containing the product and division (with precision up to 2 decimal places) of the tuple elements. If division is not possible (i.e., the denominator is 0), store "None" instead for that value. The function...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Tuple def construct_tuple_operations_dict(tuples: List[Tuple[int, int]]) -> Dict[Tuple[int, int], List[float]]: """ Constructs a dictionary where the keys are tuples of integers, and the values ar...
evol_instruct_66k
3,900
Write a Python function to compute the factorial of a given non-negative integer. The factorial of a number `n` is the product of all positive integers less than or equal to `n`. The function should handle edge cases such as `n = 0` and `n = 1` correctly. The code should start with: ```python def compute_factorial(n: ...
Here is the Python code to solve the given problem in the markdown block: ```python def compute_factorial(n: int) -> int: """ Compute the factorial of a given non-negative integer. The factorial of a number n (denoted as n!) is the product of all positive integers less than or equal to n. By definition...
evol_instruct_66k
3,901
Write a Python function to identify and extract all telephone numbers present within a given passage. The telephone numbers should match the pattern of "(XXX) XXX-XXXX", where "X" represents a digit. The function should return a list of all matched telephone numbers. The code should start with: ```python from typing i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def extract_phone_numbers(passage: str) -> List[str]: """ Extracts all telephone numbers from the given passage that match the pattern "(XXX) XXX-XXXX". Args: passage (str): The pa...
evol_instruct_66k
3,906
Write a Python function to calculate the number of days between two given dates. The dates are provided in the format "MM/DD/YYYY". The function should handle the conversion of the date strings to datetime objects and compute the difference in days. The code should start with: ```python from datetime import datetime ...
Here is the Python code to solve the given problem in the markdown block: ```python from datetime import datetime def days_between_dates(start_date: str, end_date: str) -> int: """ Calculate the number of days between two given dates. Args: start_date (str): The start date in the format "MM/DD/YYY...
evol_instruct_66k
3,911
Write a Python function to create a dictionary representing a user profile based on the given parameters. The function should take three arguments: `name`, `age`, and `occupation`. The function should return a dictionary with keys `"name"`, `"age"`, and `"occupation"` corresponding to the provided values. The code sho...
Here is the Python code to solve the given problem in the markdown block: ```python def create_user_profile(name: str, age: int, occupation: str) -> dict: """ Creates a dictionary representing a user profile based on the given parameters. Args: name (str): The name of the user. age (int): T...
evol_instruct_66k
3,918
Write a Python function to determine the day of the week for a given date in the ISO 8601 standard format (YYYY-MM-DD). The function should accept a date string as input and return the corresponding day of the week as a string. The code should start with: ```python from typing import List def get_day_of_week(date_str...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import datetime def get_day_of_week(date_string: str) -> str: """ Determine the day of the week for a given date in ISO 8601 format (YYYY-MM-DD). Args: date_string (str): The date string in ...
evol_instruct_66k
3,925
Write a Python function to create an array with 5 distinct prime numbers randomly chosen from a predefined list of prime numbers between 0 and 99. The function should ensure that the chosen numbers are distinct and within the specified range. The code should start with: ```python from typing import List import random ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def generate_distinct_primes(n: int = 5) -> List[int]: """ Generates an array with n distinct prime numbers randomly chosen from a predefined list of prime numbers between 0 and 99. Ar...
evol_instruct_66k
3,935
Write a Python function to filter and return elements from a given NumPy array that are greater than a specified threshold value. The function should utilize NumPy's boolean indexing for efficient filtering. The code should start with: ```python import numpy as np from typing import List def filter_elements_greater_t...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np from typing import List def filter_elements_greater_than(arr: np.ndarray, threshold: int) -> List[int]: """ Filters and returns elements from a given NumPy array that are greater than a specified threshold. ...
evol_instruct_66k
3,940
Write a Python function to sort a given tuple of integers in descending order. The function should return a new tuple that is sorted in descending order without modifying the original tuple. The code should start with: ```python from typing import Tuple def sort_tuple_descending(t: Tuple[int, ...]) -> Tuple[int, ...]:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple def sort_tuple_descending(t: Tuple[int, ...]) -> Tuple[int, ...]: """ Sorts a given tuple of integers in descending order and returns a new tuple. Args: t (Tuple[int, ...]): The tuple of in...
evol_instruct_66k
3,949
Write a Python function that repeatedly decrements a given integer `num` by 1 until it reaches 0, printing the string representation of `num` at each step. The function should stop when `num` becomes 0 and should not print 0. The function should start with: ```python def decrement_and_print(num: int): ```
Here is the Python code to solve the given problem in the markdown block: : ```python def decrement_and_print(num: int): """ Decrements the given integer `num` by 1 and prints its string representation until `num` reaches 0. The value 0 itself is not printed. Args: num (int): The integer to dec...
evol_instruct_66k
3,952
Write a Python function to implement the quicksort algorithm for sorting an array. The function should take a list of integers as input and return a sorted list of integers. The quicksort algorithm should be implemented using a recursive approach. The code should start with: ```python from typing import List def quic...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: """ Sorts the given array using the quicksort algorithm. Args: arr (List[int]): The array of integers to be sorted. Returns: List[int...
evol_instruct_66k
3,960
Write a Python function to extract substrings enclosed within round brackets `()` from a given text string. The function should handle hierarchically nested brackets, special typographic symbols, and escape sequences for brackets within the string. Additionally, the function should be able to handle erroneous inputs su...
Here is the Python code to solve the given problem in the markdown block: ```python def extract_substrings(text: str) -> tuple: """ Extracts substrings enclosed within round brackets from the given text string. Handles nested brackets, special typographic symbols, and escape sequences. Args: te...
evol_instruct_66k
3,989
Write a Python function to determine which participant in a literary society restricts their reading to only one specific genre, given a dictionary mapping participant names to their preferred genres. The function should return the name of the participant who reads only one genre, specifically "sci-fi". The code shoul...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Optional def find_sci_fi_only_reader(participants_genres: Dict[str, str]) -> Optional[str]: """ Determines which participant in a literary society restricts their reading to only one specific genre, spe...
evol_instruct_66k
4,002
Write a Python function to create a 5x5 NumPy array containing randomly generated floating point numbers within a specified interval. The function should allow the user to specify the lower and upper bounds of the interval. The code should start with: ```python import numpy as np def generate_random_array(lower_bound:...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def generate_random_array(lower_bound: float, upper_bound: float) -> np.ndarray: """ Generates a 5x5 NumPy array containing randomly generated floating point numbers within a specified interval. Args: ...
evol_instruct_66k
4,022
Write a Python function to convert a given single character into its corresponding ASCII numeric value. The function should handle any single character input, including special characters and digits. The code should start with: ```python def char_to_ascii(char: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def char_to_ascii(char: str) -> int: """ Convert a given single character into its corresponding ASCII numeric value. Args: char (str): The single character to be converted. Returns: int: The ASCII nume...
evol_instruct_66k
4,042
Write a Python function to convert the given variables `name`, `age`, and `if_married` to their intended data types. The function should accept three parameters: `name` (a string), `age` (a string), and `if_married` (a string). The function should return a tuple containing the converted values: `name` as a string, `age...
Here is the Python code to solve the given problem in the markdown block: ```python def convert_data_types(name: str, age: str, if_married: str) -> tuple: """ Converts the given variables to their intended data types. Args: name (str): The name as a string. age (str): The age as a string. ...
evol_instruct_66k
4,050
Write a Python function to iterate over a dictionary and return a list of tuples where each tuple contains a key-value pair from the dictionary. The function should handle any dictionary, regardless of its size or the types of its keys and values. The code should start with: ```python from typing import Dict, List, Tu...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Tuple def dict_to_list_of_tuples(dictionary: Dict) -> List[Tuple]: """ Converts a dictionary into a list of tuples where each tuple contains a key-value pair from the dictionary. Args: ...
evol_instruct_66k
4,051
Write a Python function to generate and return a list of numbers ranging from a given minimum value to a specified maximum value, inclusive. The function should start with an initial value and increment by 1 until it reaches or exceeds the maximum value. The function should handle cases where the minimum value is great...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_numbers(min_value: int, max_value: int) -> List[int]: """ Generate a list of numbers ranging from min_value to max_value, inclusive. Args: min_value (int): The starting value of...
evol_instruct_66k
4,054
Write a Python function to determine if a given string `s1` is a subsequence of another string `s2`. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. The function should start with: ```python def is_subsequence(s...
Here is the Python code to solve the given problem in the markdown block: ```python def is_subsequence(s1: str, s2: str) -> bool: """ Determines if the string `s1` is a subsequence of the string `s2`. Args: s1 (str): The subsequence candidate. s2 (str): The string in which to check for the ...
evol_instruct_66k
4,061
Write a Python function to implement the QuickSort algorithm correctly. The function should sort a list of integers in ascending order. The code should start with: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: """ Sorts a list of integers using the QuickSort algorithm. Args: arr (List[int]): The list of integers to be sorted. Returns: List[i...
evol_instruct_66k
4,063
Write a Python function to implement the Bubble Sort algorithm, which sorts a list of integers in ascending order. The function should correctly handle the swapping of elements to ensure the list is sorted. The code should start with: ```python from typing import List def bubble_sort(arr: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def bubble_sort(arr: List[int]) -> List[int]: """ Sorts a list of integers in ascending order using the Bubble Sort algorithm. Args: arr (List[int]): The list of integers to be sorted. ...
evol_instruct_66k
4,064
Write a Python function to traverse and print every element within a given 2D array consisting of three rows and three columns. Additionally, calculate the sum of elements in the main diagonal of the array. The function should start with: ```python from typing import List def traverse_and_sum_diagonal(arr: List[List[i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def traverse_and_sum_diagonal(arr: List[List[int]]) -> int: """ Traverse a 3x3 2D array, print each element, and calculate the sum of the main diagonal elements. Args: arr (List[List[int]]):...
evol_instruct_66k
4,070
Write a Python function to determine if a given tuple contains only unique elements. The function should return `True` if all elements in the tuple are unique, and `False` otherwise. The code should start with: ```python from typing import Tuple, Any def are_all_elements_unique(tup: Tuple[Any, ...]) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple, Any def are_all_elements_unique(tup: Tuple[Any, ...]) -> bool: """ Determines if all elements in the given tuple are unique. Args: tup (Tuple[Any, ...]): The tuple to check for unique elem...
evol_instruct_66k
4,077
Write a Python function to determine the highest product of three distinct elements from a given list of integers, which may include zeros. The function should efficiently handle both positive and negative integers. The code should start with: ```python from typing import List def max_product_of_three(nums: List[int])...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def max_product_of_three(nums: List[int]) -> int: """ Calculate the highest product of three distinct elements from a given list of integers. Args: nums (List[int]): A list of integers, whic...
evol_instruct_66k
4,085
Write a Python function to split a given string into words and return a list of these words. The function should handle multiple spaces between words and leading/trailing spaces. The code should start with: ```python from typing import List def split_string_into_words(s: str) -> List[str]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def split_string_into_words(s: str) -> List[str]: """ Splits a given string into words and returns a list of these words. Args: s (str): The input string to be split into words. Retur...
evol_instruct_66k
4,089
Write a Python function to create a dictionary with a specified key-value pair and return the dictionary. The function should take two parameters: the key and the value, and return a dictionary containing the specified key-value pair. The code should start with: ```python def create_dictionary(key: str, value: str) -> ...
Here is the Python code to solve the given problem in the markdown block: : ```python def create_dictionary(key: str, value: str) -> dict: """ Creates a dictionary with a specified key-value pair and returns the dictionary. Args: key (str): The key to be added to the dictionary. value (str)...
evol_instruct_66k
4,099
Write a Python function to convert a binary string consisting of '0's and '1's into its equivalent decimal (base 10) representation. The function should handle binary strings of any length, including those with leading zeros. The code should start with: ```python def binary_to_decimal(binary_string: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def binary_to_decimal(binary_string: str) -> int: """ Converts a binary string to its equivalent decimal (base 10) representation. Args: binary_string (str): A string consisting of '0's and '1's representing a binar...
evol_instruct_66k
4,100
Write a Python function to calculate the total estimated value of recovered treasures from a list of shipwreck documents. Each document is represented as a dictionary with the following schema: ```python { "_id": ObjectId(), "name": String, "captain": String, "shipType": String, "yearOfWreck": Date, "...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def total_recovered_treasure_value(shipwrecks: List[Dict]) -> float: """ Calculate the total estimated value of recovered treasures from a list of shipwreck documents. Args: shipwrecks...
evol_instruct_66k
4,117
Write a Python function to filter out all elements from a given list that are divisible by two without a remainder. The function should return a new list containing only the even numbers from the original list. The code should start with: ```python from typing import List def filter_even_numbers(numbers: List[int]) -...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def filter_even_numbers(numbers: List[int]) -> List[int]: """ Filters out all elements from the given list that are divisible by two without a remainder. Args: numbers (List[int]): The list ...
evol_instruct_66k
4,126
Write a Python function to compute the arithmetic mean of a given list of numerical values. The function should handle the case where the input list is empty by returning `None`. The code should start with: ```python from typing import List, Optional def arithmetic_mean(array: List[float]) -> Optional[float]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List, Optional def arithmetic_mean(array: List[float]) -> Optional[float]: """ Compute the arithmetic mean of a given list of numerical values. Args: array (List[float]): The list of numerical ...
evol_instruct_66k
4,128
Write a Python function to determine if a target integer is present within a sorted array of integers and count the number of times the target occurs. The function should use an optimized algorithm to achieve this. The code should start with: ```python from typing import List, Tuple def find_target_and_count(nums: Lis...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_target_and_count(nums: List[int], target: int) -> Tuple[bool, int]: """ Determine if a target integer is present within a sorted array of integers and count its occurrences. Args: ...
evol_instruct_66k
4,129
Write a Python function to calculate the total value of unique integer elements in a given list. The function should take a list of integers as input and return the sum of all unique elements in the list. The code should start with: ```python from typing import List def sum_of_unique_elements(elements: List[int]) -> ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_of_unique_elements(elements: List[int]) -> int: """ Calculate the total value of unique integer elements in a given list. Args: elements (List[int]): A list of integers from which to...
evol_instruct_66k
4,150
Write a Python function to identify and isolate unique elements from a given integer array, and then arrange these unique elements in ascending numerical order. The function should handle any integer array, including those with duplicate values and negative numbers. The code should start with: ```python from typing im...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def unique_sorted_array(input_array: List[int]) -> List[int]: """ Identifies and isolates unique elements from a given integer array, and then arranges these unique elements in ascending numerical order....
evol_instruct_66k
4,158
Write a Python function to determine if a given string matches a specific character sequence pattern using regular expressions. The pattern to match is 'abbccd'. The function should return `True` if the input string matches the pattern exactly, and `False` otherwise. The code should start with: ```python import re de...
Here is the Python code to solve the given problem in the markdown block: ```python import re def match_character_sequence(sequence: str) -> bool: """ Determines if the given string matches the pattern 'abbccd' exactly. Args: sequence (str): The string to be checked against the pattern. Retur...
evol_instruct_66k
4,179
Write a Python function to identify identical elements present within two distinct sorted arrays. The function should not use any pre-existing Python methods for set operations or list comparisons. The elements within the arrays are distinct and not consecutive. The function should start with: ```python from typing imp...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_common_elements(list1: List[int], list2: List[int]) -> List[int]: """ Identifies identical elements present within two distinct sorted arrays. Args: list1 (List[int]): The first sor...
evol_instruct_66k
4,180
Write a Python function to convert a given hexadecimal string into its binary and decimal representations. The function should handle hexadecimal strings in the format "0xFA" and return a tuple containing the binary and decimal representations. The code should start with: ```python def hex_to_bin_dec(hex_val: str) -> ...
Here is the Python code to solve the given problem in the markdown block: ```python def hex_to_bin_dec(hex_val: str) -> tuple: """ Converts a given hexadecimal string into its binary and decimal representations. Args: hex_val (str): The hexadecimal string to convert, in the format "0xFA". Retu...
evol_instruct_66k
4,186
Write a Python function to sort a given list of numerical elements in descending order. The function should return a new list with the elements arranged from the largest to the smallest. The original list should not be modified. The code should start with: ```python from typing import List def sort_descending(arr: Li...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sort_descending(arr: List[int]) -> List[int]: """ Sorts the given list of numerical elements in descending order and returns a new list. Args: arr (List[int]): The list of numerical elem...
evol_instruct_66k
4,192
Write a Python function to generate the first n perfect cubes of integers. The function should return a list of these perfect cubes. The code should start with: ```python from typing import List def generate_perfect_cubes(n: int) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_perfect_cubes(n: int) -> List[int]: """ Generate the first n perfect cubes of integers. Args: n (int): The number of perfect cubes to generate. Returns: List[int]: ...
evol_instruct_66k
4,213
Write a Python function to insert a specified delimiter string between every item in a given list of strings. The function should return a single concatenated string with the delimiter inserted between each pair of items. The code should start with: ```python from typing import List def join_with_delimiter(items: List...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def join_with_delimiter(items: List[str], delimiter: str) -> str: """ Joins a list of strings into a single string with the specified delimiter between each item. Args: items (List[str]): ...
evol_instruct_66k
4,228
Write a Python function to find and return all occurrences of the specific string sequence "123 Main Street" in a given text using a regular expression. The function should handle the string sequence as a literal pattern, ensuring that special characters are properly escaped. The code should start with: ```python impo...
Here is the Python code to solve the given problem in the markdown block: ```python import re def find_address(text: str) -> list: """ Find all occurrences of the specific string sequence "123 Main Street" in the given text. Args: text (str): The text in which to search for the string sequence. ...
evol_instruct_66k
4,231
Write a Python function to perform matrix multiplication for two given matrices. The function should ensure that the matrices are compatible for multiplication (i.e., the number of columns in the first matrix should be equal to the number of rows in the second matrix). If the matrices are not compatible, the function s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def matrix_multiply(A: List[List[int]], B: List[List[int]]) -> Optional[List[List[int]]]: """ Perform matrix multiplication for two given matrices. Args: A (List[List[int]]): The f...
evol_instruct_66k
4,232
Write a Python function to eliminate repetitive elements within a two-dimensional array consisting of integers while maintaining the original order of the subarrays. The function should ensure that each element appears only once across all subarrays. The code should start with: ```python from typing import List def el...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def eliminate_repetitive_elements(arr: List[List[int]]) -> List[List[int]]: """ Eliminates repetitive elements within a two-dimensional array while maintaining the original order of the subarrays. A...
evol_instruct_66k
4,244
Write a Python function to find the longest common subsequence (LCS) of two given strings. The LCS is the longest sequence of characters that appear in the same order in both strings, but not necessarily consecutively. The function should return the length of the LCS. The code should start with: ```python def longest_...
Here is the Python code to solve the given problem in the markdown block: ```python def longest_common_subsequence(X: str, Y: str) -> int: """ Calculate the length of the longest common subsequence (LCS) of two strings. Args: X (str): The first string. Y (str): The second string. Retur...
evol_instruct_66k
4,254
Write a Python function to reverse-sort a given list of integers. The function should return the sorted list in descending order. The code should start with: ```python from typing import List def reverse_sort_list(numbers: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def reverse_sort_list(numbers: List[int]) -> List[int]: """ Reverse-sorts a given list of integers and returns the sorted list in descending order. Args: numbers (List[int]): The list of i...
evol_instruct_66k
4,255
Write a Python function to create a dictionary where the keys are frozen sets (immutable sets) and the values are the sums of the squares of the elements in the corresponding sets. The function should take a list of sets as input and return the dictionary. The code should start with: ```python from typing import List,...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Set def create_set_square_sum_dict(sets: List[Set[int]]) -> Dict[frozenset, int]: """ Create a dictionary where the keys are frozen sets (immutable sets) and the values are the sums of the squares...
evol_instruct_66k
4,275
Write a Python function to generate the nth number in the Lucas sequence. The Lucas sequence is similar to the Fibonacci sequence but starts with 2 and 1. Each subsequent number is the sum of the two preceding numbers. The function should return the nth number in the sequence. The code should start with: ```python def...
Here is the Python code to solve the given problem in the markdown block: ```python def lucas_number(n: int) -> int: """ Generate the nth number in the Lucas sequence. The Lucas sequence is similar to the Fibonacci sequence but starts with 2 and 1. Each subsequent number is the sum of the two preceding...
evol_instruct_66k
4,283
Write a Python function to sort the text strings in a mixed list of integers and strings, while keeping the integers in their original positions. The function should return a new list with the strings sorted lexicographically and the integers unchanged. The code should start with: ```python from typing import List, Un...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def sort_mixed_list(mixed_list: List[Union[int, str]]) -> List[Union[int, str]]: """ Sorts the text strings in a mixed list of integers and strings, while keeping the integers in their original po...
evol_instruct_66k
4,284
Write a Python function to calculate the sum of all numbers in a given list. The function should handle lists of integers and floating-point numbers. The code should start with: ```python from typing import List def sum_of_numbers(num_list: List[float]) -> float: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_of_numbers(num_list: List[float]) -> float: """ Calculate the sum of all numbers in the given list. Args: num_list (List[float]): A list of numbers (integers or floating-point number...
evol_instruct_66k
4,285
Write a Python function to generate the next line in a sequence based on the previous line. The sequence is generated by counting consecutive digits and forming the next line based on these counts. The function should take a string representing the current line and return a string representing the next line. The code ...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_next_line(line: str) -> str: """ Generate the next line in a sequence based on the previous line. The sequence is generated by counting consecutive digits in the current line and forming the next line based...
evol_instruct_66k
4,290
Write a Python function to compute the nth Lucas number using an iterative approach. The Lucas sequence is similar to the Fibonacci sequence but starts with the numbers 2 and 1. The function should start with: ```python def lucas_number(n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def lucas_number(n: int) -> int: """ Compute the nth Lucas number using an iterative approach. The Lucas sequence is defined as: - L(0) = 2 - L(1) = 1 - L(n) = L(n-1) + L(n-2) for n >= 2 Args: n (in...
evol_instruct_66k
4,295
Write a Python function to calculate the greatest common divisor (GCD) of two given integers using the Euclidean algorithm. The function should handle both positive and negative integers. The code should start with: ```python def gcd(a: int, b: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: : ```python def gcd(a: int, b: int) -> int: """ Calculate the greatest common divisor (GCD) of two integers using the Euclidean algorithm. Args: a (int): The first integer. b (int): The second integer. Returns: ...
evol_instruct_66k
4,306
Write a Python function to merge two lists and return the merged list in reverse order. The function should accept two lists as parameters and return a single list that is the concatenation of the two input lists in reverse order. The code should start with: ```python from typing import List def reversed_merge(list1: ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def reversed_merge(list1: List[any], list2: List[any]) -> List[any]: """ Merges two lists and returns the merged list in reverse order. Args: list1 (List[any]): The first list to be merged. ...
evol_instruct_66k
4,313
Write a Python function to generate a random string of a specified length. The string must contain at least two uppercase letters, two lowercase letters, and two numbers. The function should validate that the generated string meets these requirements. The code should start with: ```python import random import string d...
Here is the Python code to solve the given problem in the markdown block: ```python import random import string def generate_valid_string(length: int) -> str: """ Generates a random string of the specified length that contains at least two uppercase letters, two lowercase letters, and two numbers. Arg...
evol_instruct_66k
4,328
Write a Python function to merge two sorted arrays into a single sorted array. The function should efficiently combine the elements from both arrays while maintaining the sorted order. The code should start with: ```python from typing import List def merge_sorted_arrays(arr1: List[int], arr2: List[int]) -> List[int]: ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_sorted_arrays(arr1: List[int], arr2: List[int]) -> List[int]: """ Merge two sorted arrays into a single sorted array. Args: arr1 (List[int]): The first sorted array. arr2 (...
evol_instruct_66k
4,331
Write a Python function to calculate the arithmetic mean of a given list of ages. The function should handle cases where the list is empty by returning `None`. The code should start with: ```python from typing import List, Optional def calculate_mean_age(ages: List[int]) -> Optional[float]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List, Optional def calculate_mean_age(ages: List[int]) -> Optional[float]: """ Calculate the arithmetic mean of a given list of ages. Args: ages (List[int]): A list of integers representing age...
evol_instruct_66k
4,332
Write a Python function to replace all punctuation in a given string with a specific character. The function should handle any string input and replace all punctuation marks (as defined by the `string.punctuation` constant) with the specified character. The function should be efficient and use Python's built-in string ...
Here is the Python code to solve the given problem in the markdown block: ```python import string def replace_punctuation_with_char(s: str, char: str) -> str: """ Replace all punctuation characters in the given string with the specified character. Args: s (str): The input string in which punctuati...
evol_instruct_66k
4,356
Write a Python function to sort a given list of integers in descending order. The function should return the sorted list. The code should start with: ```python from typing import List def sort_descending(arr: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def sort_descending(arr: List[int]) -> List[int]: """ Sorts a given list of integers in descending order. Args: arr (List[int]): The list of integers to be sorted. Returns: Li...
evol_instruct_66k
4,366
Write a Python function to compute a new tuple where each element is the product of consecutive elements in the input tuple. The function should handle tuples containing numerical values, including negative numbers and zeros, and should be robust to floating point numbers. If the input is not a tuple, the function shou...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple, Union def product_of_consecutive_elements(input_tuple: Tuple[Union[int, float], ...]) -> Union[Tuple[Union[int, float], ...], str]: """ Compute a new tuple where each element is the product of consecut...
evol_instruct_66k
4,373
Write a Python function to find the longest common subsequence (LCS) between two given strings. The function should return the length of the LCS. The code should start with: ```python def longest_common_subsequence(str1: str, str2: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: : ```python def longest_common_subsequence(str1: str, str2: str) -> int: """ Calculate the length of the longest common subsequence (LCS) between two strings. Args: str1 (str): The first string. str2 (str): The second...
evol_instruct_66k
4,387
Write a Python function to convert a tuple of two floating-point numbers into a complex number. The function should take a tuple as input and return a complex number where the first element of the tuple represents the real part and the second element represents the imaginary part. The code should start with: ```python...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple def tuple_to_complex(value: Tuple[float, float]) -> complex: """ Converts a tuple of two floating-point numbers into a complex number. Args: value (Tuple[float, float]): A tuple containing ...
evol_instruct_66k
4,404
Write a Python function to convert a list of integers into a fixed-size array of a specified type, and then back to a list. The function should handle the conversion between the list and the array, ensuring that the array is of the correct type and size. The code should start with: ```python from typing import List, Ty...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Type import array def convert_list_to_array_and_back(lst: List[int], array_type: Type[array.array]) -> List[int]: """ Converts a list of integers into a fixed-size array of a specified type and then bac...
evol_instruct_66k
4,411
Write a Python function to extract the first n elements from a given array and return a subarray containing those elements. The function should handle edge cases such as empty arrays and n larger than the length of the array. The code should start with: ```python from typing import List def extract_elements(arr: List[...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def extract_elements(arr: List[int], n: int) -> List[int]: """ Extracts the first n elements from a given array and returns a subarray containing those elements. Args: arr (List[int]): The a...
evol_instruct_66k
4,413
Write a Python function to determine if one string (`str_1`) is a substring of another string (`str_2`). The function should return a boolean value indicating whether `str_1` is present within `str_2`. The code should start with: ```python def is_substring(str_1: str, str_2: str) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python def is_substring(str_1: str, str_2: str) -> bool: """ Determines if `str_1` is a substring of `str_2`. Args: str_1 (str): The substring to search for. str_2 (str): The string in which to search for the subst...
evol_instruct_66k
4,414
Write a Python function to compute the total sum of each row in a given 2D matrix. The function should return a list where each element is the sum of the corresponding row in the matrix. The code should start with: ```python from typing import List def row_sums(matrix: List[List[int]]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def row_sums(matrix: List[List[int]]) -> List[int]: """ Compute the total sum of each row in a given 2D matrix. Args: matrix (List[List[int]]): A 2D matrix represented as a list of lists of ...
evol_instruct_66k
4,430
Write a Python function to convert a binary numeral, represented as a string, to its equivalent integer value in base 10. The function should handle binary strings of any length, including those with leading zeros. The code should start with: ```python def binary_to_decimal(binary_str: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def binary_to_decimal(binary_str: str) -> int: """ Converts a binary numeral, represented as a string, to its equivalent integer value in base 10. Args: binary_str (str): The binary numeral string to be converted. I...
evol_instruct_66k
4,433
Write a Python function to generate a list of `n` random integers within a specified range. The function should take three parameters: the number of random integers to generate (`n`), the lower bound of the range (`lower_bound`), and the upper bound of the range (`upper_bound`). The function should return a list of `n`...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def generate_random_integers(n: int, lower_bound: int, upper_bound: int) -> List[int]: """ Generates a list of `n` random integers within the specified range [lower_bound, upper_bound]. ...
evol_instruct_66k
4,437
Write a Python function to compute the generalized factorial of order `m` for a given number `n`. The generalized factorial of order `m` is defined as the product of `n^m` from `n=1` to `n`. The function should handle edge cases and errors effectively, such as negative inputs and non-integer inputs. Additionally, imple...
Here is the Python code to solve the given problem in the markdown block: ```python def generalized_factorial(n: int, m: int, memo: dict = {}) -> int: """ Compute the generalized factorial of order m for a given number n. The generalized factorial of order m is defined as the product of n^m from n=1 to n. ...
evol_instruct_66k
4,444
Write a Python function to construct a 4x4 NumPy array where each row contains exactly two occurrences of `-2` and two occurrences of `3`, and the order of these elements is different in each row. The function should ensure that no two rows have the same order of elements. The code should start with: ```python import ...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def construct_unique_order_array() -> np.ndarray: """ Constructs a 4x4 NumPy array where each row contains exactly two occurrences of -2 and two occurrences of 3, and the order of these elements is differ...
evol_instruct_66k
4,445
Write a Python function to find the second smallest value among four distinct positive integers, including odd numbers, without using sorting algorithms. The function should be efficient and avoid unnecessary comparisons. The code should start with: ```python def find_second_smallest(x1: int, x2: int, x3: int, x4: int...
Here is the Python code to solve the given problem in the markdown block: ```python def find_second_smallest(x1: int, x2: int, x3: int, x4: int) -> int: """ Finds the second smallest value among four distinct positive integers. Args: x1 (int): The first positive integer. x2 (int): The secon...
evol_instruct_66k
4,446
Write a Python function to identify the occupation of the second character from a provided list of characters and their respective professions. The function should take a dictionary where the keys are character names and the values are their occupations, and return the occupation of the second character in the dictiona...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def get_second_character_occupation(characters: Dict[str, str]) -> str: """ Identify the occupation of the second character from a provided list of characters and their respective professions. Args:...
evol_instruct_66k
4,448
Write a Python function to implement an efficient Quicksort algorithm tailored for sorting arrays of integer elements. The function should be optimized for computational complexity and resource usage. The code should start with: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: """ Sorts an array of integers using the Quicksort algorithm. Args: arr (List[int]): The array of integers to be sorted. Returns: Lis...
evol_instruct_66k
4,459
Write a Python function to filter out all the odd integers from a given list of numerical values. The function should use a lambda function to perform the filtering. The code should start with: ```python from typing import List def filter_odd_numbers(num_list: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def filter_odd_numbers(num_list: List[int]) -> List[int]: """ Filters out all the odd integers from the given list of numerical values. Args: num_list (List[int]): The list of integers to ...
evol_instruct_66k
4,462
Write a Python function to calculate the sum and product of elements in a given list. The function should return a tuple containing the sum and the product of the elements. The code should start with: ```python from typing import List, Tuple def calculate_sum_and_product(my_list: List[int]) -> Tuple[int, int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def calculate_sum_and_product(my_list: List[int]) -> Tuple[int, int]: """ Calculate the sum and product of elements in a given list. Args: my_list (List[int]): The list of integers fo...
evol_instruct_66k
4,463
Write a Python function to compute a result based on the comparative size of two integer variables `x` and `y`, using a given complex mathematical formula. The function should handle the conditional logic efficiently and correctly implement the mathematical formula. The code should start with: ```python def compute_res...
Here is the Python code to solve the given problem in the markdown block: ```python def compute_result(x: int, y: int) -> float: """ Compute a result based on the comparative size of two integers x and y, using a given complex mathematical formula. Args: x (int): The first integer. y (int):...
evol_instruct_66k
4,468
Write a Python function to manage a collection of student records using a dictionary (hash table) for efficient operations like search, insertion, and deletion. The function should allow adding a new student record, retrieving a student's record, and deleting a student's record. The code should start with: ```python fr...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Optional def manage_student_records(records: Dict[str, int], operation: str, student_name: Optional[str] = None, score: Optional[int] = None) -> Dict[str, int]: """ Manages a collection of student recor...
evol_instruct_66k
4,470
Write a Python function to determine if a given integer can be expressed as the result of an exponential operation where the base and exponent are both integers within a specified range. The function should return the base and exponent if such a pair exists, otherwise return `False`. The code should start with: ```pyt...
Here is the Python code to solve the given problem in the markdown block: ```python def check_exponential_result(target: int, max_range: int) -> tuple[int, int] | bool: """ Determines if the given integer can be expressed as the result of an exponential operation where the base and exponent are both integer...
evol_instruct_66k
4,477
Write a Python function to extract all valid email addresses from a given text using regular expressions. The function should return a list of all email addresses found in the text. The code should start with: ```python import re from typing import List def extract_emails(text: str) -> List[str]: ```
Here is the Python code to solve the given problem in the markdown block: ```python import re from typing import List def extract_emails(text: str) -> List[str]: """ Extracts all valid email addresses from the given text using regular expressions. Args: text (str): The text from which to extract e...
evol_instruct_66k
4,479
Write a Python function to split a given string into a list of words, where each word is separated by one or more spaces. The function should handle multiple spaces between words and leading/trailing spaces. The code should start with: ```python from typing import List def split_string_to_words(input_string: str) -> L...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def split_string_to_words(input_string: str) -> List[str]: """ Splits a given string into a list of words, where each word is separated by one or more spaces. Args: input_string (str): The i...
evol_instruct_66k
4,515
Write a Python function to generate a sequence of Fibonacci numbers up to a specified quantity of elements. The function should return a list containing the first `n` Fibonacci numbers. If `n` is less than 1, the function should return an empty list. The code should start with: ```python from typing import List def g...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_fibonacci_sequence(n: int) -> List[int]: """ Generates a sequence of the first n Fibonacci numbers. Args: n (int): The number of Fibonacci numbers to generate. Returns: ...
evol_instruct_66k
4,516
Write a Python function to calculate the sum of elements in a list of integers, incorporating Python's type hint annotations for enhanced readability and code quality. The function should start with: ```python from typing import List def sum_of_list(lst: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_of_list(lst: List[int]) -> int: """ Calculate the sum of all elements in a list of integers. Args: lst (List[int]): A list of integers whose sum needs to be calculated. Returns:...
evol_instruct_66k
4,521
Write a Python function to sort a list of integers using the Merge Sort algorithm, which has a time complexity of O(n log n). The function should be optimized for performance and should handle edge cases such as empty lists and single-element lists. The code should start with: ```python from typing import List def me...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_sort(arr: List[int]) -> List[int]: """ Sorts a list of integers using the Merge Sort algorithm. Args: arr (List[int]): The list of integers to be sorted. Returns: List...
evol_instruct_66k
4,522
Write a Python function to evaluate a postfix expression. The input to the function should be a string representing the postfix expression, where operands and operators are separated by spaces. The output should be the evaluated value of the expression. The function should handle basic arithmetic operations: addition (...
Here is the Python code to solve the given problem in the markdown block: ```python def evaluate_postfix(expression: str) -> float: """ Evaluates a postfix expression and returns the result. Args: expression (str): A string representing the postfix expression, where operands and operators are separ...
evol_instruct_66k
4,524
Write a Python function to merge two sorted lists into a single sorted list without using Python's built-in sort function or any third-party library. The final list should not contain any duplicate values. The function should start with: ```python from typing import List def merge_sorted_lists_without_duplicates(list1...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_sorted_lists_without_duplicates(list1: List[int], list2: List[int]) -> List[int]: """ Merges two sorted lists into a single sorted list without duplicates. Args: list1 (List[int]):...
evol_instruct_66k
4,536
Write a Python function to convert a hexadecimal string to its decimal equivalent. The function should handle both uppercase and lowercase hexadecimal characters and should return the decimal value as an integer. The code should start with: ```python def hex_to_decimal(hex_string: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def hex_to_decimal(hex_string: str) -> int: """ Converts a hexadecimal string to its decimal equivalent. Args: hex_string (str): The hexadecimal string to be converted. Returns: int: The decimal equival...
evol_instruct_66k
4,548
Write a Python function to flatten a multi-level, intricately interwoven numerical sequence into a single-level list. The input can be a nested list containing integers and other lists, and the output should be a single list containing all the integers in the same order as they appear in the input, without any nesting....
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def flatten_list(lst: List[Union[int, List]]) -> List[int]: """ Flattens a multi-level nested list into a single-level list. Args: lst (List[Union[int, List]]): The input list which m...
evol_instruct_66k
4,553
Write a Python function to segregate boolean data types from a given list that contains various data types. The function should return two lists: one containing all boolean values and the other containing all non-boolean values. The code should start with: ```python from typing import List, Union def segregate_boolea...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def segregate_boolean_types(myList: List[Union[int, float, complex, str, bool]]) -> (List[bool], List[Union[int, float, complex, str]]): """ Segregates boolean data types from a given list contain...
evol_instruct_66k
4,578
Write a Python function to reverse the order of a list without using any built-in functions or methods. The function should take a list of integers as input and return a new list with the elements in reverse order. The code should start with: ```python from typing import List def reverse_list(lst: List[int]) -> List[i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def reverse_list(lst: List[int]) -> List[int]: """ Reverses the order of a list of integers without using any built-in functions or methods. Args: lst (List[int]): The list of integers to be...
evol_instruct_66k
4,579
Write a Python function to validate if a given string is a valid integer and handle negative and zero inputs. If the string is not a valid integer, print an error message. The function should return `True` if the string is a valid integer (including zero), otherwise return `False`. The code should start with: ```pytho...
Here is the Python code to solve the given problem in the markdown block: ```python import re def validate_integer(input_str: str) -> bool: """ Validates if the given string is a valid integer and handles negative and zero inputs. Args: input_str (str): The string to be validated. Returns: ...
evol_instruct_66k
4,580
Write a Python function to determine whether two given phrases consist of entirely identical sets of words, considering the word frequency. The function should return `True` if the phrases have the same words with the same frequencies, and `False` otherwise. The code should start with: ```python def compare_word_sets_f...
Here is the Python code to solve the given problem in the markdown block: ```python def compare_word_sets_frequency(phrase1: str, phrase2: str) -> bool: """ Determine whether the two input phrases consist of identical sets of words, with the same word frequency. Args: phrase1 (str): The first phras...
evol_instruct_66k
4,591
Write a Python function to process a list of numerical data by multiplying each element by a specified integer and returning the transformed list. The function should maintain the original order of elements in the input list. The code should start with: ```python from typing import List def transform_list(numbers: Li...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def transform_list(numbers: List[int], multiplier: int) -> List[int]: """ Transforms a list of numerical data by multiplying each element by a specified integer. Args: numbers (List[int]): T...
evol_instruct_66k
4,592
Write a Python function to filter out all occurrences of empty tuples from a given list of tuples. The function should return a new list containing only the non-empty tuples. The code should start with: ```python from typing import List, Tuple def remove_empty_tuples(tuples_list: List[Tuple]) -> List[Tuple]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List, Tuple def remove_empty_tuples(tuples_list: List[Tuple]) -> List[Tuple]: """ Filters out all empty tuples from the given list of tuples. Args: tuples_list (List[Tuple]): A list of tuples f...