source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
evol_instruct_66k
41,492
Write a Python function to reverse the order of words in a given sentence, remove any punctuation, and capitalize the first letter of each word. The function should handle sentences with varying lengths and punctuation. The code should start with: ```python from typing import List def reverse_sentence_and_clean(sente...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import string def reverse_sentence_and_clean(sentence: str) -> str: """ Reverses the order of words in a given sentence, removes any punctuation, and capitalizes the first letter of each word. Args:...
evol_instruct_66k
41,494
Write a Python function to extract and return all digit characters from a given alphanumeric string. The function should handle any alphanumeric string and return a string containing only the digits found in the input string. The code should start with: ```python def extract_digits(alphanumeric_string: str) -> str: ``...
Here is the Python code to solve the given problem in the markdown block: ```python def extract_digits(alphanumeric_string: str) -> str: """ Extracts and returns all digit characters from the given alphanumeric string. Args: alphanumeric_string (str): The input string containing alphanumeric charac...
evol_instruct_66k
41,495
Write a Python function to display the values from a given dictionary in alphabetical order of their keys. Additionally, round off all the floating-point values in the dictionary up to 2 decimal places. The function should return a formatted string where each key-value pair is displayed on a new line, with the key and ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def display_sorted_map(in_map: Dict[str, float]) -> str: """ Display the values from the given dictionary in alphabetical order of their keys. Also, round off all the floating values up to 2 decimal ...
evol_instruct_66k
41,500
Write a Python function to determine if two given strings can be rearranged to form anagrams of each other. The function should return a boolean value indicating whether the two strings are anagrams. The code should start with: ```python from typing import List def are_anagrams(string1: str, string2: str) -> bool: ```...
Here is the Python code to solve the given problem in the markdown block: ```python from collections import Counter def are_anagrams(string1: str, string2: str) -> bool: """ Determine if two given strings can be rearranged to form anagrams of each other. Args: string1 (str): The first string to ch...
evol_instruct_66k
41,505
Write a Python function to create a new series where each element in the given series is multiplied by a constant value of two. The given series is a list of non-recurring integers. The function should return the new series as a list. The code should start with: ```python from typing import List def multiply_series_b...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def multiply_series_by_two(series: List[int]) -> List[int]: """ Creates a new series where each element in the given series is multiplied by two. Args: series (List[int]): The input series, ...
evol_instruct_66k
41,527
Write a Python function to validate if a multidimensional array of integers represents a palindromic sequence. The function should handle edge cases such as empty sub-arrays and sub-arrays of different lengths. The function should start with: ```python from typing import List def is_palindromic_sequence(arrays: List[L...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_palindromic_sequence(arrays: List[List[int]]) -> bool: """ Validates if a multidimensional array of integers represents a palindromic sequence. Args: arrays (List[List[int]]): A multi...
evol_instruct_66k
41,535
Write a Python function to validate a text string based on a specific pattern. The pattern requires the string to start with a unique non-alphanumeric symbol, followed by exactly three lowercase alphabetical characters, and end with a number consisting of 2 to 4 digits. The function should return `True` if the string m...
Here is the Python code to solve the given problem in the markdown block: ```python import re def validate_string(construct: str) -> bool: """ Validates if the given string matches the specified pattern. The pattern requires: - A unique non-alphanumeric symbol at the start. - Exactly three lowerca...
evol_instruct_66k
41,550
Write a Python function to find the unique words present in both sentences, ignoring case sensitivity and punctuation marks. The function should handle any erroneous inputs and edge cases gracefully. The code should start with: ```python from typing import List import re def find_unique_words(sentence1: str, sentence...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def find_unique_words(sentence1: str, sentence2: str) -> List[str]: """ Find unique words present in both sentences, ignoring case sensitivity and punctuation marks. Args: sentence...
evol_instruct_66k
41,554
Write a Python function to check if a given string contains a date in the format 'dd-mm-yyyy' and ends with the word "Goodbye". The function should return `True` if both conditions are met, otherwise `False`. The code should start with: ```python import re def check_string_with_date_and_goodbye(string: str) -> bool: ...
Here is the Python code to solve the given problem in the markdown block: ```python import re def check_string_with_date_and_goodbye(string: str) -> bool: """ Check if the given string contains a date in the format 'dd-mm-yyyy' and ends with the word "Goodbye". Args: string (str): The string to be...
evol_instruct_66k
41,579
Write a Python function to invert the sequence of elements within a given tuple. The function should take a tuple as input and return a new tuple with the elements in reverse order. The code should start with: ```python from typing import Tuple def invert_tuple(mytuple: Tuple) -> Tuple: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import Tuple def invert_tuple(mytuple: Tuple) -> Tuple: """ Inverts the sequence of elements within a given tuple. Args: mytuple (Tuple): The tuple whose elements are to be reversed. Returns: ...
evol_instruct_66k
41,583
Write a Python function to identify the two array elements that contribute to the maximal combined numerical value from a given list of integers. The function should return these two elements as a tuple. The code should start with: ```python from typing import List, Tuple def find_max_pair(arr: List[int]) -> Tuple[int...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_max_pair(arr: List[int]) -> Tuple[int, int]: """ Identifies the two array elements that contribute to the maximal combined numerical value. Args: arr (List[int]): The list of...
evol_instruct_66k
41,590
Write a Python function to sort an array of integer quantities in descending order. The function should take a list of integers as input and return a new list with the integers sorted in descending order. The original list should not be modified. The code should start with: ```python from typing import List def sort_...
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 an array of integer quantities in descending order. Args: arr (List[int]): The list of integers to be sorted. Returns: ...
evol_instruct_66k
41,602
Write a Python function to implement the bubble sort algorithm for sorting a list of integers in ascending order. The function should modify the input list in place and return the sorted list. The code should start with: ```python from typing import List def bubble_sort(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 bubble_sort(numbers: List[int]) -> List[int]: """ Sorts a list of integers in ascending order using the bubble sort algorithm. Args: numbers (List[int]): The list of integers to be sor...
evol_instruct_66k
41,603
Write a Python function to convert a JSON object represented as a Python dictionary to a string formatted in a specific way. The function should take a dictionary as input and return a string where each key-value pair is formatted as `key: value` and each pair is separated by a newline character. The string should not ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def json_to_formatted_string(json_obj: Dict[str, any]) -> str: """ Converts a JSON object (represented as a Python dictionary) to a formatted string. Args: json_obj (Dict[str, any]): The JSO...
evol_instruct_66k
41,605
Write a Python function to sort the elements of a given list in descending order. The function should take a list of integers as input and return a new list with the elements sorted in descending order. The original list should not be modified. The code should start with: ```python from typing import List def sort_de...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sort_descending(array: List[int]) -> List[int]: """ Sorts the elements of a given list in descending order. Args: array (List[int]): The list of integers to be sorted. Returns: ...
evol_instruct_66k
41,620
Write a Python function to calculate the sum of all elements in a given 2D array. The function should handle any rectangular 2D array, including empty arrays. The code should start with: ```python from typing import List def sum_2d_array(array_2d: List[List[int]]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def sum_2d_array(array_2d: List[List[int]]) -> int: """ Calculate the sum of all elements in a given 2D array. Args: array_2d (List[List[int]]): A 2D array of integers. Returns: ...
evol_instruct_66k
41,630
Write a Python function to reverse a given character sequence (string) efficiently. The function should handle strings of any length, including empty strings. The code should start with: ```python def reverse_string(s: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_string(s: str) -> str: """ Reverses the given character sequence (string). Args: s (str): The input string to be reversed. Returns: str: The reversed string. """ # Use slicing to rev...
evol_instruct_66k
41,631
Write a Python function to determine if two given strings are anagrams of each other without using any built-in library functions, data structures, or helper methods. The function should handle strings containing numbers, symbols, and spaces, and should have a time complexity better than O(n log n). The function should...
Here is the Python code to solve the given problem in the markdown block: ```python def are_anagrams(str1: str, str2: str) -> bool: """ Determine if two given strings are anagrams of each other. Args: str1 (str): The first string to compare. str2 (str): The second string to compare. Re...
evol_instruct_66k
41,645
Write a Python function to extract and count unique email addresses from a given text. The function should handle common email formatting standards and potential edge cases such as multiple email addresses on the same line, punctuation immediately following an email address, and variations in capitalization. The functi...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict import re def count_unique_emails(text: str) -> Dict[str, int]: """ Extracts and counts unique email addresses from a given text. Args: text (str): The text from which to extract email addre...
evol_instruct_66k
41,649
Write a Python function that demonstrates the behavior of the "else" clause within a "for" loop. The function should iterate over a given list and check for a specific condition. If the condition is met, the loop should break. If the loop completes without breaking, the "else" clause should execute, indicating that the...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def check_condition_and_loop_end(items: List[int], condition: int) -> str: """ Iterates over a list of integers and checks if any element matches a given condition. If the condition is met, the loop ...
evol_instruct_66k
41,656
Write a Python function to print a given string. Additionally, write a unit test to verify the functionality of your implemented function. The function should be named `print_string` and should take a single string argument. The unit test should be written using the `unittest` module and should verify that the function...
Here is the Python code to solve the given problem in the markdown block: ```python import unittest from unittest.mock import patch def print_string(s: str) -> None: """ Prints the given string. Args: s (str): The string to be printed. Returns: None """ print(s) class TestPri...
evol_instruct_66k
41,660
Write a Python function to compute the n-th power of each number in a given list and return a new list. The function should handle erroneous inputs and edge cases. Specifically, if the input list contains non-numeric values, the function should raise a `ValueError`. Additionally, if the power value `n` is not an intege...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def compute_nth_power(input_list: List[float], n: int) -> List[float]: """ Computes the n-th power of each number in the given list and returns a new list. Args: input_list (List[float]): Th...
evol_instruct_66k
41,662
Write a Python function to generate a list of prime numbers that are less than or equal to a given number `n`. The function should efficiently determine whether each number in the range is prime and collect all prime numbers into a list. The code should start with: ```python from typing import List def generate_prime...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_primes(n: int) -> List[int]: """ Generate a list of prime numbers that are less than or equal to the given number n. Args: n (int): The upper limit for generating prime numbers....
evol_instruct_66k
41,684
Write a Python function to identify and count the recurring numerical elements within a provided collection of integer values. The function should return a dictionary where the keys are the recurring integers and the values are their respective counts. The code should start with: ```python from typing import List, Dic...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def find_recurring_elements(my_list: List[int]) -> Dict[int, int]: """ Identify and count the recurring numerical elements within a provided collection of integer values. Args: my_list...
evol_instruct_66k
41,686
Write a Python function to classify a sequence of dates into consecutive weekly intervals, considering edge cases such as weeks that overflow into the next month or year. The function should return a dictionary where the keys are the start dates of the weeks and the values are lists of dates that fall within those week...
Here is the Python code to solve the given problem in the markdown block: ```python from datetime import datetime, timedelta from typing import List, Dict def classify_dates(date_list: List[str]) -> Dict[str, List[str]]: """ Classify a sequence of dates into consecutive weekly intervals, considering edge cases...
evol_instruct_66k
41,703
Write a Python function to create a 4-dimensional tensor of size 2 x 2 x 2 x 2, filled with prime numbers ranging from 2 up to 31. The function should ensure that the prime numbers are used in a cyclic manner if there are fewer than 16 prime numbers available. The code should start with: ```python from typing import L...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import numpy as np def create_prime_tensor() -> np.ndarray: """ Create a 4-dimensional tensor of size 2 x 2 x 2 x 2 filled with prime numbers ranging from 2 up to 31. If there are fewer than 16 prime...
evol_instruct_66k
41,707
Write a Python function to reverse a given string. The function should take a string as input and return the reversed string. The code should start with: ```python def reverse_string(input_string: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: : ```python def reverse_string(input_string: str) -> str: """ Reverses the given input string. Args: input_string (str): The string to be reversed. Returns: str: The reversed string. """ # Use slicing to ...
evol_instruct_66k
41,715
Write a Python function to sort a dictionary by the number of vowels in each key and the length of its corresponding value. The keys are strings, and the values are strings of varying lengths. The function should return the sorted dictionary. The code should start with: ```python from typing import Dict def sort_dict...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def sort_dictionary_by_vowels_and_value_length(dictionary: Dict[str, str]) -> Dict[str, str]: """ Sorts a dictionary by the number of vowels in each key and the length of its corresponding value. Ar...
evol_instruct_66k
41,718
Write a Python function to find the positional location of a particular entity within a given list. If the entity is not found in the list, the function should return `-1`. The function should handle lists of any type of elements, including nested lists. The code should start with: ```python from typing import List, A...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Any def find_position(my_list: List[Any], entity: Any) -> int: """ Find the positional location of a particular entity within a given list. If the entity is not found, return -1. Args: ...
evol_instruct_66k
41,720
Write a Python function to partition a list of integers into two lists: one containing even numbers in ascending order with duplicates removed, and the other containing odd numbers in descending order with duplicates removed. The function should perform this operation in linear time complexity. The code should start w...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def partition_list(numbers: List[int]) -> List[List[int]]: """ Partition a list of integers into two lists: one containing even numbers in ascending order with duplicates removed, and the other conta...
evol_instruct_66k
41,723
Write a Python function to count the number of prime numbers less than a given number `n` using the Sieve of Eratosthenes algorithm. The function should be efficient and handle large values of `n` effectively. The code should start with: ```python def count_primes_less_than(n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def count_primes_less_than(n: int) -> int: """ Count the number of prime numbers less than a given number n using the Sieve of Eratosthenes algorithm. Args: n (int): The upper limit (exclusive) for counting prime nu...
evol_instruct_66k
41,734
Write a Python function to determine the number of unique paths from the top-left corner to the bottom-right corner of an m x n grid, where you can only move right or down. The function should start with: ```python from typing import List def unique_paths(m: int, n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def unique_paths(m: int, n: int) -> int: """ Calculate the number of unique paths from the top-left corner to the bottom-right corner of an m x n grid. Args: m (int): The number of rows ...
evol_instruct_66k
41,736
Write a Python function to filter out every row from a given list of dictionaries where the 'Name' key precisely matches the string 'John'. The function should return a new list of dictionaries containing only the rows that do not match the specified name. 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 def filter_non_john_rows(data: List[Dict[str, any]]) -> List[Dict[str, any]]: """ Filters out rows from a list of dictionaries where the 'Name' key matches the string 'John'. Args: dat...
evol_instruct_66k
41,745
Write a Python function to find the index and value of the first element in a given list that satisfies a specified condition. The condition is defined by a lambda function that takes an element as input and returns a boolean value. The function should return a tuple containing the index and the value of the first elem...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional, Tuple def find_first_element(arr: List[int], condition: callable) -> Optional[Tuple[int, int]]: """ Find the index and value of the first element in the list that satisfies the given condition...
evol_instruct_66k
41,753
Write a Python function to interchange the first and last elements in a list, the second element with the second last element, the third element with the third last element, and so on. The function should be able to handle lists of any length and data type. 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, Any def swap_elements(lst: List[Any]) -> List[Any]: """ Interchanges the first and last elements in a list, the second element with the second last element, the third element with the third last ele...
evol_instruct_66k
41,754
Write a Python function to find the longest common subsequence (LCS) of 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) of two strings. Args: str1 (str): The first string. str2 (str): The second string...
evol_instruct_66k
41,755
Write a Python function to filter out a specific target word from a string of words. The words in the string may be separated by commas, spaces, or both. The function should return a list of words in the original order, excluding all occurrences of the target word. The code 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 filter_words(s: str, target: str) -> List[str]: """ Filters out a specific target word from a string of words. Args: s (str): The input string containing words separated by commas, space...
evol_instruct_66k
41,761
Write a Python function to delete the nth item from a given list. The function should handle cases where n is out of bounds by returning the original list unchanged. The code should start with: ```python from typing import List def delete_nth_item(lst: List[str], n: int) -> List[str]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def delete_nth_item(lst: List[str], n: int) -> List[str]: """ Deletes the nth item from the given list. Args: lst (List[str]): The list from which to delete the item. n (int): The ...
evol_instruct_66k
41,770
Write a Python function to generate a numerical array of discrete integers ranging from 1 to 25, ensuring all elements are an unpredictable permutation. The function should return the shuffled list. The code should start with: ```python from typing import List import random def generate_random_permutation() -> List[i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def generate_random_permutation() -> List[int]: """ Generates a numerical array of discrete integers ranging from 1 to 25, ensuring all elements are an unpredictable permutation. Retur...
evol_instruct_66k
41,798
Write a Python function to calculate the mode(s) of a given list of numbers without using Python's `statistics` library. The function should handle cases where there are multiple modes. The code should start with: ```python from typing import List def calculate_mode(numbers: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List from collections import Counter def calculate_mode(numbers: List[int]) -> List[int]: """ Calculate the mode(s) of a given list of numbers without using Python's statistics library. Args: num...
evol_instruct_66k
41,805
Write a Python function to reverse a given string. The function should take a string as input and return the reversed string. The code should start with: ```python def reverse_string(input_str: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_string(input_str: str) -> str: """ Reverses the given string. Args: input_str (str): The string to be reversed. Returns: str: The reversed string. """ # Use slicing to reverse the st...
evol_instruct_66k
41,815
Write a Python function to compute the Greatest Common Divisor (GCD) of a list of integers using a fast algorithm. The function should accept a list of integers and return their GCD. The constraints are: 1 <= len(numbers) <= 10^3 and 1 <= numbers[i] <= 10^6. The code should start with: ```python from typing import Lis...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List from math import gcd from functools import reduce def gcd_list(numbers: List[int]) -> int: """ Compute the Greatest Common Divisor (GCD) of a list of integers using a fast algorithm. Args: n...
evol_instruct_66k
41,819
Write a Python function to calculate the maximum value that can be represented in an n-bit binary system. The function should take an integer `n` as input, representing the number of bits, and return the maximum value that can be represented in that system. The code should start with: ```python def max_value_in_n_bits...
Here is the Python code to solve the given problem in the markdown block: ```python def max_value_in_n_bits(n: int) -> int: """ Calculate the maximum value that can be represented in an n-bit binary system. Args: n (int): The number of bits in the binary system. Returns: int: The maxim...
evol_instruct_66k
41,839
Write a Python function to calculate the total sum of the "price" values from a list of dictionaries. Each dictionary in the list contains a single key "price" with an integer value. The function should return the total sum as an integer. The code should start with: ```python from typing import List, Dict def calcula...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def calculate_total_price(list_of_dictionaries: List[Dict[str, int]]) -> int: """ Calculate the total sum of the "price" values from a list of dictionaries. Args: list_of_dictionaries ...
evol_instruct_66k
41,843
Write a Python function to find all the missing numbers in a given numerical sequential array that should contain elements ranging from 1 to 100. The array may contain gaps where some numbers are missing. The function should return a list of all the missing 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 find_missing_numbers(arr: List[int]) -> List[int]: """ Find all missing numbers in a given numerical sequential array that should contain elements ranging from 1 to 100. Args: arr (List[...
evol_instruct_66k
41,844
Write a Python function to compute the nth term in the Lucas series, a number sequence where each term is the sum of the two preceding terms. The Lucas series starts with the values 2 and 1. The function should be efficient and handle edge cases such as n being 0 or negative. The code should start with: ```python def ...
Here is the Python code to solve the given problem in the markdown block: ```python def lucas_nth_term(n: int) -> int: """ Compute the nth term in the Lucas series. The Lucas series is a number sequence where each term is the sum of the two preceding terms. The series starts with the values 2 and 1. ...
evol_instruct_66k
41,850
Write a Python function to calculate the average value of a given list of numerical elements using a for loop iteration method. The function should handle an empty list by returning `None`. The code should start with: ```python from typing import List, Optional def calculate_average(numbers: List[int]) -> Optional[fl...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def calculate_average(numbers: List[int]) -> Optional[float]: """ Calculate the average value of a given list of numerical elements using a for loop iteration method. Args: numbers...
evol_instruct_66k
41,854
Write a Python function to calculate the sum of elements in a list using an efficient approach. The function should handle large lists efficiently and should be optimized for performance. The code should start with: ```python from typing import List def efficient_sum(lst: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def efficient_sum(lst: List[int]) -> int: """ Calculate the sum of elements in a list efficiently. Args: lst (List[int]): The list of integers to sum. Returns: int: The sum of t...
evol_instruct_66k
41,856
Write a Python function to find the largest number in an unsorted array without using the built-in `max()` function. The function should iterate through the array and keep track of the largest number found so far. The code should start with: ```python from typing import List def find_largest_number(arr: List[int]) -> ...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def find_largest_number(arr: List[int]) -> int: """ Find the largest number in an unsorted array. Args: arr (List[int]): The unsorted array of integers. Returns: int: The larg...
evol_instruct_66k
41,868
Write a Python function to analyze a given CSS module and extract all attributes associated with a specific ID selector, including those of directly correlated elements and auxiliary styles. The function should return a dictionary where the keys are the attribute names and the values are the attribute values. The code...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List import re def extract_css_attributes(css_module: str, id_selector: str) -> Dict[str, str]: """ Extracts all attributes associated with a specific ID selector from a given CSS module. Args: ...
evol_instruct_66k
41,872
Write a Python function to merge a list of numerical characters into a single integer, and then compute the sum of its digits. The function should take a list of strings, where each string represents a numerical character, and return the sum of the digits of the resulting integer. The code should start with: ```python...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_of_digits_from_list(lst: List[str]) -> int: """ Merges a list of numerical characters into a single integer and computes the sum of its digits. Args: lst (List[str]): A list of strin...
evol_instruct_66k
41,877
Write a Python function to calculate the sum of the three largest values in a given list of integers. The function should handle lists of any length, including those with fewer than three elements. If the list has fewer than three elements, the function should return the sum of all elements in the list. The code shoul...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_of_three_largest(sequence: List[int]) -> int: """ Calculate the sum of the three largest values in a given list of integers. Args: sequence (List[int]): The list of integers from whi...
evol_instruct_66k
41,884
Write a Python function to generate the first N prime numbers. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The function should return a list of the first N prime numbers. The code should start with: ```python from typing import List def generate_first_n_pri...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_first_n_primes(N: int) -> List[int]: """ Generate the first N prime numbers. Args: N (int): The number of prime numbers to generate. Returns: List[int]: A list cont...
evol_instruct_66k
41,885
Write a Python function to calculate the sum of a list of numbers efficiently. The function should handle large lists and avoid redundant computations. The code should start with: ```python from typing import List def efficient_sum(numbers: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def efficient_sum(numbers: List[int]) -> int: """ Calculate the sum of a list of integers efficiently. Args: numbers (List[int]): A list of integers to be summed. Returns: int: ...
evol_instruct_66k
41,888
Write a Python function to reverse the order of words in a given sentence while maintaining the integrity of each word. The function should take a string as input and return a string with the words in reverse order. The code should start with: ```python def reverse_words_order(sentence: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_words_order(sentence: str) -> str: """ Reverses the order of words in a given sentence while maintaining the integrity of each word. Args: sentence (str): The input sentence whose words are to be reverse...
evol_instruct_66k
41,912
Write a Python function to create a custom dictionary from two parallel lists or tuples, applying a filter criteria to the resulting dictionary. The function should use dictionary comprehension for efficiency and readability. The code should start with: ```python from typing import List, Tuple, Dict def create_filter...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def create_filtered_dict(keys: List[str], values: List[int], filter_value: int) -> Dict[str, int]: """ Creates a dictionary from two parallel lists or tuples, applying a filter criteria to t...
evol_instruct_66k
41,917
Write a Python function that uses a Regular Expression to identify all lexemes in a given string that end with the letter sequence "ing". The function should correctly distinguish between "ing" at the end of a word and "ing" within a word. The function should return a list of all such lexemes. The code should start wi...
Here is the Python code to solve the given problem in the markdown block: ```python import re from typing import List def find_ing_ending_words(text: str) -> List[str]: """ Finds all lexemes in the given text that end with the letter sequence "ing". Args: text (str): The input text to search for l...
evol_instruct_66k
41,931
Write a Python function to manage a list of person objects, each containing attributes such as `id`, `first_name`, `last_name`, `age`, and `address` (which is a dictionary containing `street`, `city`, `state`, `country`, and `postal_code`). The function should be able to: 1. Calculate the average age of all persons in ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Union Person = Dict[str, Union[int, str, Dict[str, str]]] def average_age(persons: List[Person]) -> float: """ Calculate the average age of all persons in the list. Args: persons (Li...
evol_instruct_66k
41,932
Write a Python function to remove duplicate elements from a given list of integers while maintaining the order of the first occurrence of each element. The function should return a new list with all duplicate elements removed. The code should start with: ```python from typing import List def remove_duplicates(arr: Li...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def remove_duplicates(arr: List[int]) -> List[int]: """ Removes duplicate elements from a given list of integers while maintaining the order of the first occurrence of each element. Args: ...
evol_instruct_66k
41,945
Write a Python function to sort an array of whole numbers in ascending order using the Bubble Sort algorithm. The function should modify the input array in place and return the sorted array. 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 an array of whole numbers in ascending order using the Bubble Sort algorithm. Args: arr (List[int]): The array of whole numbers to be ...
evol_instruct_66k
41,946
Write a Python function to validate whether every character in a given string consists exclusively of alphabetical characters or numerical digits. The function should return `True` if all characters in the string are either alphabetic or numeric, and `False` otherwise. The code should start with: ```python def is_alph...
Here is the Python code to solve the given problem in the markdown block: ```python def is_alphanumeric(s: str) -> bool: """ Validates whether every character in the given string consists exclusively of alphabetical characters or numerical digits. Args: s (str): The string to be validated. ...
evol_instruct_66k
41,956
Write a Python function to convert all characters of a given string to lowercase. The function should handle strings of varying lengths and characters, including special characters and numbers. The code should start with: ```python def convert_to_lowercase(input_string: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def convert_to_lowercase(input_string: str) -> str: """ Converts all characters in the input string to lowercase. Args: input_string (str): The string to be converted to lowercase. Returns: str: The inp...
evol_instruct_66k
41,962
Write a Python function to calculate the number of Perfect numbers within the first N numbers of the Lucas sequence. A Perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. The Lucas sequence is defined as: - L(0) = 2 - L(1) = 1 - L(n) = L(n-1) + L(n-2) for n >= 2 The ...
Here is the Python code to solve the given problem in the markdown block: ```python def count_perfect_lucas_numbers(N: int) -> int: """ Calculate the number of Perfect numbers within the first N numbers of the Lucas sequence. Args: N (int): The number of terms in the Lucas sequence to consider. ...
evol_instruct_66k
41,976
Write a Python function to calculate both the sum and the product of all elements in a given array. The function should handle arrays of varying lengths and return both the sum and the product as a tuple. The code should start with: ```python from typing import List, Tuple def calculate_sum_and_product(arr: List[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(arr: List[int]) -> Tuple[int, int]: """ Calculate the sum and product of all elements in the given array. Args: arr (List[int]): The array of integers fo...
evol_instruct_66k
41,984
Write a Python function to calculate the standard deviation and variance of a given list of numbers. The function should correctly implement the mathematical formulas for standard deviation and variance. The code should start with: ```python from typing import List def calculate_std_dev_and_variance(numbers: List[floa...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math def calculate_std_dev_and_variance(numbers: List[float]) -> (float, float): """ Calculate the standard deviation and variance of a given list of numbers. Args: numbers (List[floa...
evol_instruct_66k
41,989
Write a Python function to merge two dictionaries and handle conflicting entries by summing the values of the same keys across both dictionaries. The function should return a set of tuples where each tuple represents a unique key-value pair from the merged dictionary. The code should start with: ```python from typing ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Set def merge_dicts_with_summed_conflicts(dict1: Dict[str, int], dict2: Dict[str, int]) -> Set[tuple]: """ Merges two dictionaries and handles conflicting entries by summing the values of the same keys....
evol_instruct_66k
41,990
Write a Python function to extract the first alphabetical character from each word in a given string. The function should handle various edge cases, such as words with no alphabetical characters, multiple spaces, and leading/trailing spaces. The code should start with: ```python from typing import List def extract_fir...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def extract_first_alpha_chars(text: str) -> List[str]: """ Extracts the first alphabetical character from each word in the given string. Args: text (str): The input string from which to extr...
evol_instruct_66k
41,991
Write a Python function to generate all prime numbers within the range from 1 to a given number `n` (inclusive) using the Sieve of Eratosthenes algorithm. The function should return a list of all prime numbers found within this range. The code should start with: ```python from typing import List def generate_primes(n...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_primes(n: int) -> List[int]: """ Generate all prime numbers up to and including a given number n using the Sieve of Eratosthenes algorithm. Args: n (int): The upper limit of the...
evol_instruct_66k
42,042
Write a Python function to reverse a given list using slicing. Additionally, identify and explain the issue in the provided incorrect code snippet that attempts to reverse the list using slicing. The code should start with: ```python from typing import List def reverse_list(array: 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_list(array: List[int]) -> List[int]: """ Reverses the given list using slicing. Args: array (List[int]): The list to be reversed. Returns: List[int]: The reversed li...
evol_instruct_66k
42,043
Write a Python function to determine if any word in a given list of words has the vowel 'o' in its second-last letter position, while ensuring that the function returns `False` if the word is a palindrome, even if it has 'o' in the second-last letter position. The function should not use any built-in Python functions f...
Here is the Python code to solve the given problem in the markdown block: ```python def has_o_second_last(words: list) -> bool: """ Determines if any word in the given list has the vowel 'o' in its second-last letter position, while ensuring that the function returns False if the word is a palindrome. ...
evol_instruct_66k
42,075
Write a Python function to find the maximum even number from a list of integers, ensuring the list has at least 3 elements. Use list comprehension to filter out the even numbers. The function should return the maximum even number if the list meets the criteria, otherwise return a message indicating the list does not me...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def max_even_number(numbers: List[int]) -> Union[int, str]: """ Find the maximum even number from a list of integers, ensuring the list has at least 3 elements. Args: numbers (List[in...
evol_instruct_66k
42,079
Write a Python function to generate a 5x5 NumPy matrix filled with random decimal numbers within a specified range. The function should allow the user to specify the lower and upper bounds of the range. The code should start with: ```python import numpy as np def generate_random_matrix(lower_bound: float, upper_bound:...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def generate_random_matrix(lower_bound: float, upper_bound: float) -> np.ndarray: """ Generate a 5x5 NumPy matrix filled with random decimal numbers within the specified range. Args: lower_bound ...
evol_instruct_66k
42,081
Write a Python function to convert a range of decimal numbers to their ternary (base-3) representation and store the results in a dictionary. The keys of the dictionary should be the original decimal numbers, and the values should be their corresponding ternary representations. The function should handle the conversion...
Here is the Python code to solve the given problem in the markdown block: ```python def decimal_to_ternary_range(start: int, end: int) -> dict: """ Convert a range of decimal numbers to their ternary (base-3) representation and store the results in a dictionary. Args: start (int): The starting numb...
evol_instruct_66k
42,083
Write a Python function to construct a dictionary that records the frequency of each character in a given ASCII text string. The dictionary keys should be the characters from the string, and the values should be the counts of each character's occurrences. Ensure the solution maintains counting efficiency. The code sho...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def character_frequency(string: str) -> Dict[str, int]: """ Constructs a dictionary that records the frequency of each character in a given ASCII text string. Args: string (str): The input s...
evol_instruct_66k
42,087
Write a Python function to remove all occurrences of a specified element from a list and return the modified list. The function should handle cases where the element is not present in the list without raising an error. The code should start with: ```python from typing import List def remove_all_occurrences(lst: List[i...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def remove_all_occurrences(lst: List[int], element: int) -> List[int]: """ Removes all occurrences of the specified element from the given list and returns the modified list. Args: lst (Li...
evol_instruct_66k
42,096
Write a Python function to perform a shallow copy of a dictionary. The function should take a dictionary as input and return a new dictionary that is a shallow copy of the input dictionary. The shallow copy should duplicate the dictionary structure but not the objects within it. 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 def shallow_copy_dict(original: Dict) -> Dict: """ Creates a shallow copy of the given dictionary. Args: original (Dict): The dictionary to be copied. Returns: Dict: A new dicti...
evol_instruct_66k
42,097
Write a Python function to perform a cyclic shift operation on a list of floating-point numbers. The shift can be either leftward or rightward, and the number of positions to shift is determined by a given integer. The function should handle cases where the shift value is larger than the length of the list by using mod...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def cyclic_shift(lst: List[float], k: int, direction: str) -> List[float]: """ Perform a cyclic shift on a list of floating-point numbers. Args: lst (List[float]): The list of floating-point...
evol_instruct_66k
42,105
Write a Python function to calculate 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`. The function should handle edge cases such as `n = 0` and `n = 1` correctly. The code should start with: ```python def f...
Here is the Python code to solve the given problem in the markdown block: ```python def factorial(n: int) -> int: """ Calculate 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
42,123
Write a Python function to efficiently eliminate recurring elements from a predefined list and return a new list containing the sum of adjacent numbers that were the same before they were removed. The function should maintain the order of non-recurring numbers and handle large lists of numbers. 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 sum_adjacent_duplicates(lst: List[int]) -> List[int]: """ Eliminates recurring elements from a list and returns a new list containing the sum of adjacent numbers that were the same before they were r...
evol_instruct_66k
42,143
Write a Python function to print the individual elements of a given tuple. The function should iterate over the tuple and print each element on a new line. The code should start with: ```python def print_tuple_elements(tup: tuple): ```
Here is the Python code to solve the given problem in the markdown block: : ```python def print_tuple_elements(tup: tuple): """ Prints each element of the given tuple on a new line. Args: tup (tuple): The tuple whose elements are to be printed. Returns: None: The function does not retu...
evol_instruct_66k
42,147
Write a Python function to camouflage specific words in a given text by replacing them with asterisks (`*`) of the same length. The function should handle case sensitivity and ensure that only whole words are replaced, not substrings. The code should start with: ```python from typing import List def camouflage_text(te...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def camouflage_text(text: str, lexicon: List[str]) -> str: """ Camouflages specific words in a given text by replacing them with asterisks of the same length. Args: text (str): The...
evol_instruct_66k
42,149
Write a Python function to generate the Fibonacci series up to the nth position using an optimized recursive approach. The function should avoid redundant computations typically associated with recursive Fibonacci calculations by using memoization. The code should start with: ```python from typing import Dict def fibo...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def fibonacci_series(n: int, computed: Dict[int, int] = {0: 0, 1: 1}) -> int: """ Generate the Fibonacci series up to the nth position using an optimized recursive approach with memoization. Args: ...
evol_instruct_66k
42,170
Write a Python function to reverse the order of elements in a given list. The function should return a new list with the elements in reverse order, without modifying the original list. The code should start with: ```python from typing import List def reverse_array(input_array: 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_array(input_array: List[int]) -> List[int]: """ Returns a new list with the elements of the input list in reverse order. Args: input_array (List[int]): The list of integers to be...
evol_instruct_66k
42,181
Write a Python function to merge two nested dictionaries. The function should handle nested dictionaries by recursively merging them. If a key exists in both dictionaries and the corresponding values are dictionaries, these should be merged recursively. If the values are not dictionaries, the value from the second dict...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def merge_nested_dicts(dict1: Dict, dict2: Dict) -> Dict: """ Merge two nested dictionaries. If a key exists in both dictionaries and the corresponding values are dictionaries, these should be merged...
evol_instruct_66k
42,199
Write a Python function to dynamically generate a Fibonacci-like sequence array, where each next term is the sum of the previous term and a randomly generated number between -50 and 50. The array should contain 15 terms. The function should also accept an optional callback function that manipulates the randomly generat...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Callable, Optional import random def generate_fibonacci_like_sequence(callback: Optional[Callable[[int], int]] = None) -> List[int]: """ Generates a Fibonacci-like sequence where each next term is the s...
evol_instruct_66k
42,224
Write a Python function to calculate the number of unique paths from the top-left corner to the bottom-right corner of an m x n grid, where you can only move right or down. The function should start with: ```python from typing import List def unique_paths(m: int, n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def unique_paths(m: int, n: int) -> int: """ Calculate the number of unique paths from the top-left corner to the bottom-right corner of an m x n grid. Args: m (int): The number of row...
evol_instruct_66k
42,233
Write a Python function to transform a given textual representation into an array of bytes using UTF-8 encoding. The function should handle any string input and return the corresponding byte array. The code should start with: ```python def string_to_bytes(text: str) -> bytearray: ```
Here is the Python code to solve the given problem in the markdown block: ```python def string_to_bytes(text: str) -> bytearray: """ Transforms a given textual representation into an array of bytes using UTF-8 encoding. Args: text (str): The textual representation to be converted into bytes. R...
evol_instruct_66k
42,237
Write a Python function to replace every instance of the string '9' with the string 'n' in a given 2D array of numerical strings. The function should return the modified 2D array. The code should start with: ```python from typing import List def replace_nines_with_n(array: List[List[str]]) -> List[List[str]]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def replace_nines_with_n(array: List[List[str]]) -> List[List[str]]: """ Replace every instance of the string '9' with the string 'n' in a given 2D array of numerical strings. Args: array (L...
evol_instruct_66k
42,242
Write a Python function to translate a given string into its binary representation, where each character is represented by its 8-bit binary equivalent. The function should return a single string where each binary representation is separated by a space. The code should start with: ```python def string_to_binary(s: str)...
Here is the Python code to solve the given problem in the markdown block: ```python def string_to_binary(s: str) -> str: """ Translates a given string into its binary representation, where each character is represented by its 8-bit binary equivalent. Args: s (str): The input string to be translated...
evol_instruct_66k
42,251
Write a Python function named `custom_binary_search` that performs a binary search on a 2D matrix of sorted sequences. The matrix is sorted such that rows are sorted from left to right and columns are sorted from top to bottom. The function should take two arguments: a 2D matrix containing integers and floating-point n...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional, Tuple def custom_binary_search(matrix: List[List[float]], target: float) -> Optional[Tuple[int, int]]: """ Perform a binary search on a 2D matrix to find the coordinates of a target number. ...
evol_instruct_66k
42,253
Write a Python function to sort a list using the insertion sort algorithm. The insertion sort algorithm works by iterating through the list and inserting each element into its correct position in the sorted part of the list. The code should start with: ```python from typing import List def insertion_sort(lst: List[int...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def insertion_sort(lst: List[int]) -> List[int]: """ Sorts a list of integers using the insertion sort algorithm. Args: lst (List[int]): The list of integers to be sorted. Returns: ...
evol_instruct_66k
42,296
Write a Python function to synchronize two dictionaries into a unified dictionary, ensuring all elements from both dictionaries are preserved. If there are overlapping keys, the value from the second dictionary should overwrite the value from the first dictionary. The function 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 Dict def synchronize_dictionaries(dictA: Dict[str, int], dictB: Dict[str, int]) -> Dict[str, int]: """ Synchronize two dictionaries into a unified dictionary, ensuring all elements are preserved. If there...
evol_instruct_66k
42,314
Write a Python function to compute the symmetric discrepancy between two sets. The symmetric discrepancy is defined as the set of elements that are in either of the sets but not in their intersection. The function should take two sets as input and return a new set containing the symmetric discrepancy. The code should ...
Here is the Python code to solve the given problem in the markdown block: ```python def symmetric_discrepancy(set1: set, set2: set) -> set: """ Compute the symmetric discrepancy between two sets. The symmetric discrepancy is the set of elements that are in either of the sets but not in their intersecti...
evol_instruct_66k
42,317
Write a Python function to generate a new list containing the squares of the elements from a given list, using list comprehensions. Additionally, extend the function to handle a nested list (a list of lists) and generate a new nested list where each element is squared. The function should start with: ```python from typ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def square_elements(data: List[int]) -> List[int]: """ Generate a new list containing the squares of the elements from the given list. Args: data (List[int]): The list of integers to be squa...
evol_instruct_66k
42,326
Write a Python function to create and return a dictionary containing personal information. The dictionary should have three keys: "Name", "Address", and "Phone". The function should accept three parameters corresponding to the values for these keys. The code should start with: ```python def create_personal_info(name: ...
Here is the Python code to solve the given problem in the markdown block: ```python def create_personal_info(name: str, address: str, phone: str) -> dict: """ Creates and returns a dictionary containing personal information. Args: name (str): The name of the person. address (str): The addre...
evol_instruct_66k
42,330
Write a Python function to merge two sorted arrays into a single sorted array without using the built-in `sorted` function or the `+` operator for concatenation. The function should efficiently merge the arrays in O(n + m) time complexity, where n and m are the lengths of the two arrays. The code should start with: ``...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_sorted_arrays(array1: List[int], array2: List[int]) -> List[int]: """ Merges two sorted arrays into a single sorted array. Args: array1 (List[int]): The first sorted array. ...
evol_instruct_66k
42,348
Write a Python function to merge three numeric arrays into a single output array, containing the elements of all three input arrays alternately starting with the first array. If any array is shorter than the others, its missing elements should be ignored in the output. The code should start with: ```python from typing...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_alternately(arr1: List[int], arr2: List[int], arr3: List[int]) -> List[int]: """ Merges three numeric arrays into a single output array, containing the elements of all three input arrays altern...
evol_instruct_66k
42,349
Write a Python function to generate and initialize a specified number of empty array list structures. The function should return a list containing all the initialized empty array lists. The code should start with: ```python from typing import List def initialize_empty_array_lists(num_lists: int) -> List[List]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def initialize_empty_array_lists(num_lists: int) -> List[List]: """ Generates and initializes a specified number of empty array list structures. Args: num_lists (int): The number of empty ar...
evol_instruct_66k
42,360
Write a Python function to display a 2D matrix consisting of integer elements in a formatted manner. The function should take a 2D list of integers as input and print each row of the matrix on a new line, with elements separated by a space. The code should start with: ```python from typing import List def display_matr...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def display_matrix(matrix: List[List[int]]) -> None: """ Displays a 2D matrix consisting of integer elements in a formatted manner. Args: matrix (List[List[int]]): A 2D list of integers repr...
evol_instruct_66k
42,365
Write a Python function to detect and count the number of Unicode whitespace characters within a given input text. The function should be able to recognize and count various Unicode whitespace characters, including but not limited to, spaces, tabs, newlines, and other special whitespace characters. The code should sta...
Here is the Python code to solve the given problem in the markdown block: ```python import re def count_unicode_whitespaces(input_text: str) -> int: """ Counts the number of Unicode whitespace characters in the given input text. Args: input_text (str): The input text in which to count Unicode whit...