source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
evol_instruct_66k
5,539
Write a Python function to calculate the product of two integers and return the result. The function should handle the case where one or both of the integers are negative. The code should start with: ```python def multiply_integers(a: int, b: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def multiply_integers(a: int, b: int) -> int: """ Calculate the product of two integers. Args: a (int): The first integer. b (int): The second integer. Returns: int: The product of the two integ...
evol_instruct_66k
5,548
Write a Python function to implement the merge sort algorithm, which sorts an array of integers in ascending order. The function should be able to handle any array of integers, including negative numbers and duplicates. The code should start with: ```python from typing import List def merge_sort(arr: List[int]) -> Lis...
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 an array of integers in ascending order using the merge sort algorithm. Args: arr (List[int]): The array of integers to be sorted. ...
evol_instruct_66k
5,556
Write a Python function to generate a string that starts with "Hola" followed by the reverse of a given string, and ends with "Hello". The reverse of a string is obtained by flipping the characters from end to start. The function should handle any non-empty string input. The code should start with: ```python def mirro...
Here is the Python code to solve the given problem in the markdown block: ```python def mirror_string(s: str) -> str: """ Generates a string that starts with "Hola", followed by the reverse of the given string, and ends with "Hello". Args: s (str): The input string to be reversed and included in th...
evol_instruct_66k
5,568
Write a Python function to implement the binary search algorithm for a sorted array. The function should return the index of the target element if it is present in the array, otherwise it should return -1. The function should be efficient and handle edge cases such as an empty array or a target element that is not in t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def binary_search(arr: List[int], target: int) -> int: """ Implements the binary search algorithm to find the index of a target element in a sorted array. Args: arr (List[int]): A sorted lis...
evol_instruct_66k
5,569
Write a Python function to replace all numerical digits in a given string with a specific character. The function should handle any string input and replace all occurrences of the digits '0' to '9' with the specified character. The code should start with: ```python def replace_digits_with_char(input_string: str, replac...
Here is the Python code to solve the given problem in the markdown block: ```python def replace_digits_with_char(input_string: str, replacement_char: str) -> str: """ Replace all numerical digits in the given string with a specific character. Args: input_string (str): The input string in which digi...
evol_instruct_66k
5,577
Write a Python function to find the last non-zero digit in the factorial of a given number `n`. The function should efficiently compute the result without directly calculating the factorial, which can be computationally expensive for large numbers. The code should start with: ```python def last_nonzero_digit_factorial(...
Here is the Python code to solve the given problem in the markdown block: ```python def last_nonzero_digit_factorial(n: int) -> int: """ Calculate the last non-zero digit of the factorial of a given number n. Args: n (int): The number for which to find the last non-zero digit of its factorial. ...
evol_instruct_66k
5,579
Write a Python function to simulate a bank account that tracks a user's balance and performs multiple transactions. The function should calculate and display whether the account is solvent (balance >= 0) or insolvent (balance < 0) after each transaction. The function should also track the number of transactions and the...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def bank_account_simulation(transactions: List[int]) -> None: """ Simulate a bank account with multiple transactions and track the account's solvency. Args: transactions (List[int]): A list ...
evol_instruct_66k
5,594
Write a Python function that takes in two lists and a function (block) as input, and uses the function to combine the elements of the two lists. The function should return a new list where each element is the result of applying the given function to the corresponding elements of the two input lists. If the input lists ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Callable def combine_elements(arr1: List[int], arr2: List[int], func: Callable[[int, int], int]) -> List[int]: """ Combines elements from two lists using a given function. Args: arr1 (List[...
evol_instruct_66k
5,607
Write a Python function to create a dictionary from a list of tuples. Each tuple contains two integer values. The key of the dictionary should be the first element of each tuple, and the value should be a list of the product of the first element and the second element of each tuple. If the key is already present in the...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def create_product_dict(list_of_tuples: List[Tuple[int, int]]) -> Dict[int, List[int]]: """ Create a dictionary from a list of tuples. Each tuple contains two integer values. The key of ...
evol_instruct_66k
5,613
Write a Python function to increment each element in a list of tuples by a specified increment value. The function should take a list of tuples and an integer increment value as input and return a new list of tuples where each element in the original tuples has been incremented by the specified value. The code should ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def increment_tuple_elements(tuples: List[Tuple[int, int]], increment: int) -> List[Tuple[int, int]]: """ Increment each element in a list of tuples by a specified increment value. Args: ...
evol_instruct_66k
5,623
Write a Python function to replace HTML and JavaScript special characters in a given string with their corresponding HTML entities. The function should ensure that both HTML tags and JavaScript code within these tags are correctly escaped. The special characters to be replaced are: - `>` with `&gt;` - `<` with `&lt;` -...
Here is the Python code to solve the given problem in the markdown block: ```python def html_entity_parser(input_str: str) -> str: """ Replaces HTML and JavaScript special characters in a given string with their corresponding HTML entities. Args: input_str (str): The input string containing HTML ta...
evol_instruct_66k
5,624
Write a Python function to convert a given date string in the format "YYYY-MM-DD" to a new date string in the format "DD-MM-YYYY". The function should also handle the case where the input date string is invalid or in an incorrect format. If the input date string is invalid, the function should return the string "Invali...
Here is the Python code to solve the given problem in the markdown block: ```python from datetime import datetime def convert_date_format(date_str: str) -> str: """ Converts a date string from "YYYY-MM-DD" format to "DD-MM-YYYY" format. Args: date_str (str): The input date string in "YYYY-MM-DD" f...
evol_instruct_66k
5,643
Write a Python function to compute the aggregate of a provided array that potentially encapsulates diverse categories of constituents. The function should separate and aggregate numeric values and string values. The numeric values should be summed, and the string values should be concatenated. The function should retur...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def aggregate_array(arr: List[object]) -> Tuple[int, str]: """ Compute the aggregate of a provided array that potentially encapsulates diverse categories of constituents. Numeric values are su...
evol_instruct_66k
5,650
Write a Python function to find the length of the largest contiguous subset of alphabetic characters within a given string. The function should ignore any non-alphabetic characters and return the length of the longest sequence of consecutive alphabetic characters. The code should start with: ```python def largest_alph...
Here is the Python code to solve the given problem in the markdown block: ```python def largest_alpha_subset(text: str) -> int: """ Find the length of the largest contiguous subset of alphabetic characters in the given string. Args: text (str): The input string to search for the largest alphabetic ...
evol_instruct_66k
5,652
Write a Python function to construct a linked list data structure and provide functionality to find and return a specific node based on user input. The linked list should support adding nodes and searching for a node by its value. The code should start with: ```python from typing import Optional class Node: def _...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Optional class Node: def __init__(self, value): self.value = value self.next = None class LinkedList: def __init__(self): self.head = None def add_node(self, value): """ ...
evol_instruct_66k
5,659
Write a Python function to partition a list of integers into two nested lists, where the first list contains all even numbers and the second list contains all odd numbers. Both lists should be sorted in descending order, and the function should handle negative numbers as well. The code should start with: ```python from...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def partition_and_sort_numbers(lst: List[int]) -> List[List[int]]: """ Partition a list of integers into two nested lists, the first consisting of even numerals and the subsequent filled with odd numeral...
evol_instruct_66k
5,661
Write a Python function to compute the discounted price of an item given the original cost and a discount rate. The function should handle cases where the discount rate is not provided by using a default discount rate of 15%. The function should also ensure that the discount rate is within a valid range (0 to 1). If th...
Here is the Python code to solve the given problem in the markdown block: ```python def compute_discounted_price(cost: float, discount_rate: float = 0.15) -> float: """ Compute the discounted price of an item given the original cost and a discount rate. Args: cost (float): The original price of the...
evol_instruct_66k
5,674
Write a Python function to create a dictionary from a given list of words where each word is a key and its corresponding value is the length of the word. The function should handle cases where the input list might be empty or contain non-string elements. If a non-string element is encountered, it should be ignored. Th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def create_word_length_dict(words: List[str]) -> Dict[str, int]: """ Creates a dictionary from a list of words where each word is a key and its length is the value. Args: words (List[s...
evol_instruct_66k
5,689
Write a Python function to calculate the Least Common Multiple (LCM) of two given integers. The function should use the greatest common divisor (GCD) to compute the LCM efficiently. The code should start with: ```python import math def lcm(x: int, y: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: : ```python import math def lcm(x: int, y: int) -> int: """ Calculate the Least Common Multiple (LCM) of two integers. Args: x (int): The first integer. y (int): The second integer. Returns: int: The Lea...
evol_instruct_66k
5,691
Write a Python function to count the number of consonant characters in a given string. A consonant is any alphabetic character that is not a vowel (i.e., 'a', 'e', 'i', 'o', 'u'). The function should be case-insensitive and should only count alphabetic characters. The code should start with: ```python def count_conson...
Here is the Python code to solve the given problem in the markdown block: ```python def count_consonants(input_string: str) -> int: """ Count the number of consonant characters in a given string. Args: input_string (str): The input string to count consonants from. Returns: int: The num...
evol_instruct_66k
5,702
Write a Python function to calculate the first 50 Fibonacci numbers using memoization to optimize the computation. The function should return a list of the first 50 Fibonacci numbers. The code should start with: ```python from typing import List def first_50_fibonacci() -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import functools def first_50_fibonacci() -> List[int]: """ Calculate and return the first 50 Fibonacci numbers using memoization. Returns: List[int]: A list containing the first 50 Fibonacc...
evol_instruct_66k
5,707
Write a Python function to calculate and return the list of squares of each element in a given list. The function should utilize a single `while` loop to iterate through the list and compute the squares. The code should start with: ```python from typing import List def calculate_squares(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 calculate_squares(numbers: List[int]) -> List[int]: """ Calculate the squares of each element in the given list using a single 'while' loop. Args: numbers (List[int]): The list of intege...
evol_instruct_66k
5,713
Write a Python function to display the elements of a given list in reverse order, print each element twice, and handle exceptions when the list is empty or contains non-integer values. The function should start with: ```python from typing import List def display_reverse_twice(nums: List[int]) -> None: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def display_reverse_twice(nums: List[int]) -> None: """ Display the elements of a given list in reverse order, printing each element twice. Handle exceptions for empty lists and non-integer values. ...
evol_instruct_66k
5,721
Write a Python function to compute the determinant of a given square matrix. The matrix should be a list of lists, where each inner list represents a row of the matrix. The elements of the matrix should be floating-point values. If the matrix is not square or contains non-floating-point values, raise a `ValueError`. Th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import numpy as np def is_valid_matrix(matrix: List[List[float]]) -> bool: """ Checks if a matrix is square and contains only floating point values. Args: matrix (List[List[float]]): The mat...
evol_instruct_66k
5,749
Write a Python function to translate English expressions into their Spanish counterparts using a predefined dictionary. If the input expression is not found in the dictionary, return a default message indicating that the translation is not available. The code should start with: ```python def translate_to_spanish(word:...
Here is the Python code to solve the given problem in the markdown block: ```python def translate_to_spanish(word: str) -> str: """ Translates an English expression into its Spanish counterpart using a predefined dictionary. Args: word (str): The English expression to be translated. Returns: ...
evol_instruct_66k
5,752
Write a Python function to reverse a given list without using the built-in `reverse()` method or slicing. The function should modify the original list in place. The code should start with: ```python from typing import List def reverse_list_in_place(lst: List[int]) -> None: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def reverse_list_in_place(lst: List[int]) -> None: """ Reverses the given list in place without using the built-in reverse() method or slicing. Args: lst (List[int]): The list to be reversed...
evol_instruct_66k
5,760
Write a Python function to generate a secure random string of a specified length, composed of numbers, letters, and special characters. The function should ensure that the generated string is not easily guessable or derivable, enhancing its security. The code should start with: ```python from typing import Optional de...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Optional import random import string def generate_secure_random_string(length: int = 12) -> str: """ Generates a secure random string of the specified length, composed of numbers, letters, and special charact...
evol_instruct_66k
5,772
Write a Python function to calculate the Fibonacci sequence up to a given number `n` using recursion and memoization to ensure that the time complexity does not exceed O(n). The function should not use any built-in functions or libraries other than basic data structures like dictionaries for memoization. The code shou...
Here is the Python code to solve the given problem in the markdown block: ```python def fibonacci_sequence(n: int) -> int: """ Calculate the Fibonacci sequence up to a given number n using recursion and memoization. Args: n (int): The position in the Fibonacci sequence to calculate. Returns: ...
evol_instruct_66k
5,782
Write a Python function to transform a given alphanumeric text into its corresponding leetspeak representation. Leetspeak is a digital language where certain letters are replaced by numbers or other characters. The standard conventions for leetspeak are as follows: - 'A' or 'a' is replaced by '4' - 'E' or 'e' is replac...
Here is the Python code to solve the given problem in the markdown block: ```python def to_leetspeak(text: str) -> str: """ Transforms the given alphanumeric text into its corresponding leetspeak representation. Args: text (str): The input text to be transformed into leetspeak. Returns: ...
evol_instruct_66k
5,785
Write a Python function to calculate the maximum sum of a subarray of a given array using Kadane's Algorithm. The function should return the maximum sum of the subarray. The code should start with: ```python from typing import List def max_subarray_sum(arr: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def max_subarray_sum(arr: List[int]) -> int: """ Calculate the maximum sum of a subarray using Kadane's Algorithm. Args: arr (List[int]): The input array of integers. Returns: ...
evol_instruct_66k
5,789
Write a Python function to generate all possible valid anagrams of a given string. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. The function should return a list of all unique anagrams. The code should start with:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List from itertools import permutations def get_anagrams(input_string: str) -> List[str]: """ Generate all possible valid anagrams of a given string. Args: input_string (str): The input string fo...
evol_instruct_66k
5,791
Write a Python function to find the index of a given value in an unordered list. If the value is not found, return -1. The function should be efficient and handle edge cases such as an empty list or a value not present in the list. The code should start with: ```python from typing import List def find_element(arr: Li...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_element(arr: List[int], value: int) -> int: """ Find the index of a given value in an unordered list. If the value is not found, return -1. Args: arr (List[int]): The unordered list...
evol_instruct_66k
5,797
Write a Python function to remove sequential duplicates from a list and return a new list where each remaining element's occurrence reflects a provided count. The function should consider case sensitivity while checking for duplicates. The code should start with: ```python from typing import List def remove_sequential...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_sequential_duplicates_with_count(lst: List[str], count: int) -> List[str]: """ Removes sequential duplicates from a list and returns a new list where each remaining element's occurrence reflec...
evol_instruct_66k
5,801
Write a Python function to create a 4x4 matrix from four given parameters and then print the elements of the matrix in a spiral order. The function should start with: ```python from typing import List def create_and_spiral_order_matrix(a: int, b: int, c: int, d: int) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def create_and_spiral_order_matrix(a: int, b: int, c: int, d: int) -> List[int]: """ Create a 4x4 matrix from four given parameters and return the elements in spiral order. Args: a (int): Th...
evol_instruct_66k
5,802
Write a Python function to classify emails into two categories based on the content: "spam" or "regular". The function should identify spam emails by checking for specific phrases or words commonly found in spam messages. If any of these phrases or words are found in the email text, the email should be classified as "s...
Here is the Python code to solve the given problem in the markdown block: ```python def classify_email(email_text: str) -> str: """ Classify an email into 'spam' or 'regular' based on the presence of specific spam phrases. Args: email_text (str): The text content of the email to be classified. ...
evol_instruct_66k
5,813
Write a Python function to encode a given string into its equivalent hexadecimal representation and another function to decode the hexadecimal representation back to the original string. The encoding and decoding should be done by considering the ASCII representation of the characters. The code should start with: ```py...
Here is the Python code to solve the given problem in the markdown block: ```python def encode_to_hex(input_string: str) -> str: """ Encodes a given string into its equivalent hexadecimal representation. Args: input_string (str): The string to be encoded. Returns: str: The hexadecimal ...
evol_instruct_66k
5,819
Write a Python function to generate a sequence of numbers, each of which is cubed, using a list comprehension for optimized and concise code. The function should take an integer `n` as input and return a list of the first `n` cubes. The code should start with: ```python def generate_cubes(n: int) -> list: ```
Here is the Python code to solve the given problem in the markdown block: ```python def generate_cubes(n: int) -> list: """ Generates a list of the first n cubes using a list comprehension. Args: n (int): The number of cubes to generate. Returns: list: A list containing the first n cub...
evol_instruct_66k
5,843
Write a Python function to determine if two integers are equal or not. The function should return `True` if the integers are equal, and `False` otherwise. The function should handle invalid inputs gracefully by returning `None` for non-integer inputs. The code should start with: ```python def are_integers_equal(a: int...
Here is the Python code to solve the given problem in the markdown block: ```python def are_integers_equal(a: int, b: int) -> bool: """ Determines if two integers are equal. Args: a (int): The first integer to compare. b (int): The second integer to compare. Returns: bool: True...
evol_instruct_66k
5,853
Write a Python function to generate 2000 random integers within a specified range and calculate the median of these integers. The function should ensure that the generated integers are sorted in ascending order before calculating the median. The code should start with: ```python from typing import List, Tuple import r...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple import random import numpy as np def generate_and_find_median(low: int, high: int) -> Tuple[List[int], float]: """ Generates 2000 random integers within the specified range [low, high] and calcula...
evol_instruct_66k
5,858
Write a Python function to swap the first and last items in a given list, and additionally, reverse the order of the middle items. The function should handle lists of any length, including empty lists and lists with a single element. The code should start with: ```python from typing import List def swap_and_reverse_mi...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def swap_and_reverse_middle(my_list: List[int]) -> List[int]: """ Swaps the first and last items in a given list and reverses the order of the middle items. Args: my_list (List[int]): The ...
evol_instruct_66k
5,861
Write a Python function to remove consecutive repeating characters from a given string. The function should return a new string where all sequential duplicates are removed. The code should start with: ```python def remove_consecutive_duplicates(input_string: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def remove_consecutive_duplicates(input_string: str) -> str: """ Removes consecutive repeating characters from the given string. Args: input_string (str): The input string from which consecutive duplicates are to be...
evol_instruct_66k
5,870
Write a Python function to generate a dictionary that encapsulates the designations of learners along with their respective grade points in their courses. The function should take a list of tuples, where each tuple contains a learner's name and their grade point, and return a dictionary with the learner's name as the k...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def generate_learner_grades(grades: List[Tuple[str, int]]) -> Dict[str, int]: """ Generate a dictionary encapsulating the designations of learners along with their respective grade points. ...
evol_instruct_66k
5,871
Write a Python function to calculate the occurrence rate of each distinct term in a given English phrase. The function should return a dictionary where the keys are the distinct terms and the values are their respective occurrence counts. The function should be case-insensitive, meaning "This" and "this" should be cons...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def word_occurrence_rate(sentence: str) -> Dict[str, int]: """ Calculate the occurrence rate of each distinct term in a given English phrase. Args: sentence (str): The input English phrase. ...
evol_instruct_66k
5,876
Write a Python function to calculate the frequency distribution of individual alphabetical characters in a given string. The function should return a dictionary where the keys are the characters and the values are their respective frequencies. The function should be case-insensitive, meaning 'A' and 'a' should be treat...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def character_frequency(word: str) -> Dict[str, int]: """ Calculate the frequency distribution of individual alphabetical characters in a given string. Args: word (str): The input string for...
evol_instruct_66k
5,885
Write a Python function to compute the Fibonacci series up to the nth term and return the sequence as a list. The function should ensure that the sequence is computed efficiently using an iterative approach. The code should start with: ```python from typing import List def fibonacci_sequence(n: int) -> List[int]: ```...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def fibonacci_sequence(n: int) -> List[int]: """ Compute the Fibonacci sequence up to the nth term and return the sequence as a list. Args: n (int): The number of terms in the Fibonacci sequ...
evol_instruct_66k
5,897
Write a Python function to calculate the collective sum of all the even integers and odd integers within a given numerical series. The function should return a tuple containing the sum of even integers and the sum of odd integers. The code should start with: ```python from typing import List, Tuple def sum_even_odd(n...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def sum_even_odd(numbers: List[int]) -> Tuple[int, int]: """ Calculate the collective sum of all the even integers and odd integers within a given numerical series. Args: numbers (Lis...
evol_instruct_66k
5,902
Refactor the provided code to use a dictionary data structure with a 'for' iteration cycle as its core elements. The original code checks if a value `x` is present in a list and prints a message if it is. The refactored code should achieve the same functionality using a dictionary. The code should start with: ```pytho...
Here is the Python code to solve the given problem in the markdown block: ```python def check_value_in_dict(dict_data: dict, x: int) -> None: """ Checks if the value `x` is present in the keys of the dictionary `dict_data` and prints a message if it is. Args: dict_data (dict): A dictionary where ke...
evol_instruct_66k
5,906
Write a Python function to generate a multi-dimensional array (list of lists) where each sublist contains a sequence of 10 consecutive whole numbers. The first sublist should start from 1 and each subsequent sublist should start where the previous one ended. The function should return the complete catalog as a list of ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_catalog() -> List[List[int]]: """ Generates a multi-dimensional array where each sublist contains 10 consecutive whole numbers. The first sublist starts from 1, and each subsequent subli...
evol_instruct_66k
5,908
Write a Python function to remove all digit-based characters from a given text document. The function should use regular expressions to efficiently identify and eliminate all digits from the text. The code should start with: ```python import re def remove_digits(text: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python import re def remove_digits(text: str) -> str: """ Removes all digit-based characters from the given text document. Args: text (str): The input text document from which digits need to be removed. Returns: ...
evol_instruct_66k
5,909
Write a Python function to initialize a 2D array of size `n x n` with the values of the product of their respective indices `(i * j)` efficiently. The function should optimize both time and space complexity, and ensure readability and maintainability. The code should start with: ```python from typing import List def i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import numpy as np def initialize_2d_array(n: int) -> List[List[int]]: """ Initializes a 2D array of size n x n with the values of the product of their respective indices (i * j). Args: n (i...
evol_instruct_66k
5,912
Write a Python function to tokenize a given utterance (a string) into its constituent words and return them as a list. The function should handle multiple spaces between words and leading/trailing spaces. The code should start with: ```python from typing import List def tokenize_utterance(utterance: str) -> List[str]:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def tokenize_utterance(utterance: str) -> List[str]: """ Tokenizes a given utterance into its constituent words and returns them as a list. Args: utterance (str): The input string to be toke...
evol_instruct_66k
5,922
Write a Python function to find all unique divisors of a given integer `n`. The function should return a list of all integers that divide `n` without leaving a remainder. The code should start with: ```python from typing import List def find_divisors(n: int) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_divisors(n: int) -> List[int]: """ Find all unique divisors of a given integer `n`. Args: n (int): The integer for which to find the divisors. Returns: List[int]: A lis...
evol_instruct_66k
5,933
Write a Python function to convert a given integer into its equivalent ancient Roman numeral notation. The function should handle integers in the range from 1 to 3999. The code should start with: ```python def int_to_roman(num: int) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def int_to_roman(num: int) -> str: """ Converts a given integer into its equivalent ancient Roman numeral notation. Args: num (int): The integer to be converted, must be in the range 1 to 3999. Returns: ...
evol_instruct_66k
5,939
Write a Python function to group strings based on the frequency of characters used in them. The function should be case-insensitive and should not consider spaces while grouping. Special characters and numbers should be included in the grouping. The code should start with: ```python from typing import List, Dict, Tuple...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Tuple, Any from collections import Counter def group_strings_by_frequency(lst: List[str]) -> List[List[str]]: """ Groups strings based on the frequency of characters used in them. Args: ...
evol_instruct_66k
5,942
Write a Python function to verify if a given string consists solely of alphabetic characters (both uppercase and lowercase). The function should take one parameter (a string) and return a boolean value (True if the string only contains alphabetic characters, False otherwise). The function should handle edge cases such ...
Here is the Python code to solve the given problem in the markdown block: ```python def is_alphabetic_string(s: str) -> bool: """ Verify if a given string consists solely of alphabetic characters (both uppercase and lowercase). Args: s (str): The string to be checked. Returns: bool: Tr...
evol_instruct_66k
5,952
Write a Python function to evaluate a given arithmetic expression that involves nested operations. The function should first evaluate the inner parentheses, then perform the multiplication, and finally return the result. The expression will be provided as a string in the form of "a * (b + c)". The code should start wi...
Here is the Python code to solve the given problem in the markdown block: ```python def evaluate_expression(expression: str) -> int: """ Evaluates a given arithmetic expression of the form "a * (b + c)". Args: expression (str): The arithmetic expression to evaluate. Returns: int: The r...
evol_instruct_66k
5,958
Write a Python function to merge two prearranged lists of distinct integers into a single ordered list. The function should efficiently combine the two lists while maintaining the order of elements. The code should start with: ```python from typing import List def merge_sorted_lists(list1: List[int], list2: List[int])...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_sorted_lists(list1: List[int], list2: List[int]) -> List[int]: """ Merges two prearranged lists of distinct integers into a single ordered list. Args: list1 (List[int]): The first ...
evol_instruct_66k
5,963
Write a Python function to count the number of alphabetic characters in a given string, excluding whitespace and punctuation. The function should ignore any non-alphabetic characters and return the count of alphabetic characters. The code should start with: ```python def count_alphabetic_characters(input_string: str) ...
Here is the Python code to solve the given problem in the markdown block: : ```python def count_alphabetic_characters(input_string: str) -> int: """ Counts the number of alphabetic characters in the given string, excluding whitespace and punctuation. Args: input_string (str): The string to count al...
evol_instruct_66k
5,966
Write a Python function to convert a list of hexadecimal numbers to their corresponding octal representations. The function should handle a list of up to 15 hexadecimal numbers. The code should start with: ```python from typing import List def hex_to_octal(hex_list: List[str]) -> List[str]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def hex_to_octal(hex_list: List[str]) -> List[str]: """ Converts a list of hexadecimal numbers to their corresponding octal representations. Args: hex_list (List[str]): A list of hexadecim...
evol_instruct_66k
5,980
Write a Python function to calculate the Greatest Common Divisor (GCD) of a list of integers efficiently. The function should be optimized to handle large input sizes within the constraints: 1 <= len(numbers) <= 10^5 and 1 <= numbers[i] <= 10^9. The function should start with: ```python from typing import List def gcd...
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_array(numbers: List[int]) -> int: """ Calculate the Greatest Common Divisor (GCD) of a list of integers. Args: numbers (List[int]): ...
evol_instruct_66k
5,983
Write a Python function to sort a given list of integers in ascending order. The function should return the sorted list. The code should start with: ```python from typing import List def sort_array(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 sort_array(array: List[int]) -> List[int]: """ Sorts a given list of integers in ascending order. Args: array (List[int]): The list of integers to be sorted. Returns: List...
evol_instruct_66k
5,991
Write a Python function to invert the keys and values of a given dictionary. The function should return a new dictionary where the keys are the values from the original dictionary, and the values are the corresponding keys. If the original dictionary contains duplicate values, the function should handle this by overwri...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def invert_dictionary(input_dict: Dict[str, int]) -> Dict[int, str]: """ Inverts the keys and values of a given dictionary. Args: input_dict (Dict[str, int]): The dictionary to be inverted. ...
evol_instruct_66k
5,993
Write a Python function to perform a bi-directional shift on a list of floating-point numbers by a specified number of places. The function should return two lists: one that is left-shifted and one that is right-shifted by the given number of places. The code should start with: ```python from typing import List def bi...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def bidirectional_shift(lst: List[float], k: int) -> (List[float], List[float]): """ Perform a bi-directional shift on a list of floating-point numbers by a specified number of places. Args: ...
evol_instruct_66k
5,995
Write a Python function to count the occurrence rate of each distinct alphabetic character in a given linguistic phrase, considering both uppercase and lowercase characters as the same. The function should return a dictionary where the keys are the characters and the values are their respective counts. The code should ...
Here is the Python code to solve the given problem in the markdown block: ```python from collections import Counter from typing import Dict def count_alphabetic_chars(phrase: str) -> Dict[str, int]: """ Count the occurrence rate of each distinct alphabetic character in the given phrase, considering both up...
evol_instruct_66k
5,997
Write a Python function to generate a 2D array of size `m x n`, filling it with numbers from 1 to `m*n` in a zig-zag pattern. The zig-zag pattern alternates between filling rows from left to right and from right to left. The code should start with: ```python from typing import List def generate_zigzag_array(m: int, n...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_zigzag_array(m: int, n: int) -> List[List[int]]: """ Generate a 2D array of size m x n filled with numbers from 1 to m*n in a zig-zag pattern. Args: m (int): The number of rows ...
evol_instruct_66k
5,999
Write a Python function that converts a tuple containing a pair of floating-point numbers into a complex number. The function should accept a tuple of two floats and return a complex number where the first float represents the real part and the second float represents the imaginary part. The code should start with: ``...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple def tuple_to_complex(numbers: Tuple[float, float]) -> complex: """ Converts a tuple containing a pair of floating-point numbers into a complex number. Args: numbers (Tuple[float, float]): A...
evol_instruct_66k
6,013
Write a Python function to determine if two given arrays contain identical elements but in an inverse sequence. The function should return `True` if the elements in the first array are the same as the elements in the second array but in reverse order, and `False` otherwise. The code should start with: ```python from ty...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def are_arrays_reversed(arr1: List[int], arr2: List[int]) -> bool: """ Determines if two arrays contain identical elements but in an inverse sequence. Args: arr1 (List[int]): The first array...
evol_instruct_66k
6,024
Write a Python function to determine whether a given number is a palindrome and provide a detailed step-by-step explanation of the logical reasoning and computational process used to arrive at the conclusion. The function should print the steps it takes to check the palindrome property and return `True` if the number i...
Here is the Python code to solve the given problem in the markdown block: ```python def describe_palindrome_check(num: int) -> bool: """ Determines whether a given number is a palindrome and provides a detailed step-by-step explanation of the process. Args: num (int): The number to check for palind...
evol_instruct_66k
6,027
Write a Python function to calculate the total number of fruits given the quantities of apples and oranges. The function should accept two integer parameters representing the number of apples and oranges, respectively, and return the sum of these two quantities. The code should start with: ```python def total_fruits(a...
Here is the Python code to solve the given problem in the markdown block: ```python def total_fruits(apples: int, oranges: int) -> int: """ Calculate the total number of fruits given the quantities of apples and oranges. Args: apples (int): The number of apples. oranges (int): The number of...
evol_instruct_66k
6,035
Write a Python function to calculate the sum of the squares of the elements in a given list of integers. The function should iterate through the list, compute the square of each element, and then sum these squares. The code should start with: ```python from typing import List def sum_of_squares(numbers: List[int]) -> ...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def sum_of_squares(numbers: List[int]) -> int: """ Calculate the sum of the squares of the elements in a given list of integers. Args: numbers (List[int]): A list of integers for which to ...
evol_instruct_66k
6,036
Write a Python function to multiply the elements of a given tuple and append the result to a specified list. The function should return the modified list. The code should start with: ```python from typing import List, Tuple def multiply_tuple_elements_and_append(tup: Tuple[int], lst: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List, Tuple def multiply_tuple_elements_and_append(tup: Tuple[int], lst: List[int]) -> List[int]: """ Multiplies the elements of a given tuple and appends the result to a specified list. Args: ...
evol_instruct_66k
6,038
Write a Python function to generate the first `n` terms of the Fibonacci sequence. The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, usually starting with 0 and 1. The function should return a list containing the first `n` terms of the sequence. The code should start...
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]: """ Generate the first n terms of the Fibonacci sequence. The Fibonacci sequence is a series of numbers where each number is the sum of the two ...
evol_instruct_66k
6,060
Write a Python function to perform a ternary search on a sorted numerical array. The function should return the index of the target element if it exists in the array, otherwise return -1. The ternary search divides the array into three parts and recursively narrows down the search space. 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 ternary_search(arr: List[int], x: int) -> int: """ Perform a ternary search on a sorted numerical array to find the index of the target element. Args: arr (List[int]): A sorted list of i...
evol_instruct_66k
6,086
Write a Python function to calculate the number of ways to jump exactly `k` steps, starting from 0, taking steps of size 1, 2, or `m`, and not going beyond `n`. The function should be named `number_of_ways_to_jump` and should take three parameters: `n` (the maximum number of steps allowed), `k` (the exact number of ste...
Here is the Python code to solve the given problem in the markdown block: ```python def number_of_ways_to_jump(n: int, k: int, m: int) -> int: """ Calculate the number of ways to jump exactly k steps, starting from 0, taking steps of size 1, 2, or m, and not going beyond n. Args: n (int): The maxim...
evol_instruct_66k
6,089
Write a Python function to process a list of integers by performing a specified operation on each element and returning the modified list. The operation to be performed is squaring each element. The function should start with: ```python from typing import List def square_elements(my_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 square_elements(my_list: List[int]) -> List[int]: """ Squares each element in the input list and returns a new list with the squared values. Args: my_list (List[int]): The list of intege...
evol_instruct_66k
6,093
Write a Python function to merge two dictionaries and exclude any key-value pairs where the value is of type string. The function should check the type of each value before adding it to the merged dictionary. The code should start with: ```python from typing import Dict def merge_and_filter_dicts(dict1: Dict, dict2: D...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def merge_and_filter_dicts(dict1: Dict, dict2: Dict) -> Dict: """ Merges two dictionaries and excludes any key-value pairs where the value is of type string. Args: dict1 (Dict): The first di...
evol_instruct_66k
6,098
Write a Python function to calculate the sum of the first `n` elements of a given list `A` using an iterative approach. The function should be efficient and handle edge cases such as an empty list or `n` being greater than the length of the list. The code should start with: ```python from typing import List def sum_f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_first_n_elements(A: List[int], n: int) -> int: """ Calculate the sum of the first n elements of the given list A. Args: A (List[int]): The list of integers from which to calculate th...
evol_instruct_66k
6,119
Write a Python function to compute the cumulative sum of a given list of numbers. The cumulative 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`. The code should start with: ```python from typing import List def cumulative_sum(numbers: List...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def cumulative_sum(numbers: List[int]) -> List[int]: """ Compute the cumulative sum of a given list of numbers. Args: numbers (List[int]): The list of numbers for which to compute the cumula...
evol_instruct_66k
6,130
Write a Python function to generate a random integer within a specified range, considering both the lower and upper boundaries. The function should handle cases where the lower boundary is greater than the upper boundary by swapping them. Additionally, if the boundaries are equal, the function should return that value....
Here is the Python code to solve the given problem in the markdown block: ```python import random def generate_random_integer(min_val: int, max_val: int) -> int: """ Generate a random integer within the specified range, considering both the lower and upper boundaries. Args: min_val (int): The lowe...
evol_instruct_66k
6,136
Write a Python function to find the largest number from a given set of binary strings. Each binary string represents a number in binary format. The function should convert each binary string to its integer equivalent and then determine the largest integer among them. 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 def find_largest_binary_number(binary_strings: List[str]) -> int: """ Find the largest number from a given set of binary strings. Args: binary_strings (List[str]): A list of binary strings w...
evol_instruct_66k
6,140
Write a Python function to generate the first `n` terms of the Fibonacci sequence, where each term is the sum of the two preceding ones. The function should return a list of the first `n` 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 terms of the Fibonacci sequence. The Fibonacci sequence is a series of numbers where each number is the sum of the two precedi...
evol_instruct_66k
6,141
Write a Python function to convert an ASCII string into its binary representation. Each character in the string should be converted to its 8-bit binary equivalent, and the binary representations should be separated by spaces. The function should handle any ASCII string input and return the corresponding binary string. ...
Here is the Python code to solve the given problem in the markdown block: ```python def ascii_to_binary(input_string: str) -> str: """ Converts an ASCII string into its binary representation. Each character in the input string is converted to its 8-bit binary equivalent, and the binary representations ...
evol_instruct_66k
6,174
Write a Python function to merge two dictionaries such that the resulting dictionary contains only the keys that are present in both input dictionaries. For each common key, the value should be a tuple consisting of the corresponding values from both dictionaries. The code should start with: ```python from typing impo...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Tuple def merge_dictionaries(given_dictionary: Dict[str, int], predefined_dictionary: Dict[str, int]) -> Dict[str, Tuple[int, int]]: """ Merges two dictionaries based on common keys, forming a new dicti...
evol_instruct_66k
6,195
Write a Python function to create an identity matrix of size n x n using NumPy. The function should return the identity matrix as a NumPy array. The code should start with: ```python import numpy as np def create_identity_matrix(n: int) -> np.ndarray: ```
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def create_identity_matrix(n: int) -> np.ndarray: """ Create an identity matrix of size n x n using NumPy. Args: n (int): The size of the identity matrix. Returns: np.ndarray: A NumP...
evol_instruct_66k
6,212
Write a Python function to reverse the characters in a given string and return the reversed string. The function should handle any non-empty string input. The code should start with: ```python def reverse_string(text: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: : ```python def reverse_string(text: str) -> str: """ Reverses the characters in a given string and returns the reversed string. Args: text (str): The input string to be reversed. Returns: str: The reversed strin...
evol_instruct_66k
6,214
Write a Python function to efficiently remove duplicate elements from a given list of integers while preserving the order of the first occurrence of each element. The function should use an appropriate data structure to achieve this in an optimal manner. The code should start with: ```python from typing import List d...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_duplicates_preserve_order(numbers: List[int]) -> List[int]: """ Removes duplicate elements from the given list of integers while preserving the order of the first occurrence of each element. ...
evol_instruct_66k
6,218
Write a Python function that iterates over a list and prints the index and value of each element using the `enumerate` function. The function should adhere to PEP8 conventions and be optimized for efficiency. The code should start with: ```python from typing import List def print_indexed_elements(arr: List[int]) -> No...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def print_indexed_elements(arr: List[int]) -> None: """ Iterates over the given list and prints the index and value of each element. Args: arr (List[int]): The list of integers to iterate ov...
evol_instruct_66k
6,223
Write a Python function to print the elements at odd indices in a given array and also find the sum of those elements. The function should return the sum of the elements at odd indices. The code should start with: ```python from typing import List def sum_of_elements_at_odd_indices(array: 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_elements_at_odd_indices(array: List[int]) -> int: """ Prints the elements at odd indices in the given array and returns the sum of those elements. Args: array (List[int]): The arr...
evol_instruct_66k
6,250
Write a Python function to sort a given list of strings in alphabetical order, considering case sensitivity and case insensitivity. The function should return two lists: one sorted case-sensitively and the other sorted case-insensitively. The code should start with: ```python from typing import List def sort_strings(...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sort_strings(string_list: List[str]) -> (List[str], List[str]): """ Sorts a given list of strings in both case-sensitive and case-insensitive manners. Args: string_list (List[str]): The ...
evol_instruct_66k
6,258
Write a Python function to calculate the total revenue for a given list of transactions. Each transaction is represented as a dictionary with keys `"item"`, `"price"`, and `"quantity"`. The total revenue is calculated by summing the product of `"price"` and `"quantity"` for each transaction. The code should start with...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def calculate_total_revenue(transactions: List[Dict[str, int]]) -> int: """ Calculate the total revenue from a list of transactions. Each transaction is represented as a dictionary with keys "...
evol_instruct_66k
6,271
Write a Python function to determine if each number within a list is within a specified range. The function should return `True` if all numbers in the list are within the inclusive range `[lower_limit, upper_limit]`, and `False` otherwise. The function should handle edge cases such as empty lists and invalid range limi...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def within_range(lst: List[int], lower_limit: int, upper_limit: int) -> bool: """ Determine if each number in the list is within the specified inclusive range [lower_limit, upper_limit]. Args: ...
evol_instruct_66k
6,273
Write a Python function to merge two lists of strings while preserving the order of elements and removing duplicates. The function should return a new list containing all unique elements from both lists, maintaining the order of their first appearance. The code should start with: ```python from typing import List def...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_unique_lists(arr1: List[str], arr2: List[str]) -> List[str]: """ Merge two lists of strings while preserving the order of elements and removing duplicates. Args: arr1 (List[str]): ...
evol_instruct_66k
6,278
Write a Python function to generate the first `n` digits of the Fibonacci series using an array-based data structure for efficient storage and retrieval. The function should start with: ```python from typing import List def generate_fibonacci_sequence(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_sequence(n: int) -> List[int]: """ Generate the first n digits of the Fibonacci series using an array-based data structure. Args: n (int): The number of Fibonacci digi...
evol_instruct_66k
6,280
Write a Python function to efficiently retrieve the last element from a deque and ensure that the memory usage is handled efficiently. The function should remove the last element from the deque and return it. The code should start with: ```python from collections import deque def get_and_remove_last_element(d: deque) ...
Here is the Python code to solve the given problem in the markdown block: ```python from collections import deque def get_and_remove_last_element(d: deque) -> str: """ Retrieves and removes the last element from a deque, ensuring efficient memory handling. Args: d (deque): The deque from which to ...
evol_instruct_66k
6,285
Write a Python function to compute the product of three given integers. The function should handle any integer inputs, including negative numbers and zero. The code should start with: ```python def multiply_triplet(a: int, b: int, c: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def multiply_triplet(a: int, b: int, c: int) -> int: """ Computes the product of three given integers. Args: a (int): The first integer. b (int): The second integer. c (int): The third integer. ...
evol_instruct_66k
6,292
Write a Python program that sorts a list using the Bubble Sort algorithm from scratch. Additionally, implement a binary search function to find an element in the sorted list. Ensure that your program includes error checking and edge case handling, such as removing non-integer items from the list before sorting. The cod...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def bubble_sort(arr: List[int]) -> List[int]: """ Sorts a list of integers using the Bubble Sort algorithm. Args: arr (List[int]): The list of integers to be sorted. Returns: ...
evol_instruct_66k
6,293
Write a Python function to convert a given text string to uppercase, ensuring that the function handles various edge cases such as empty strings, strings with special characters, and strings with numbers. The function should also be able to handle multi-line strings. The code should start with: ```python def convert_to...
Here is the Python code to solve the given problem in the markdown block: : ```python def convert_to_uppercase(text: str) -> str: """ Converts the given text string to uppercase. This function takes a text string as input and returns a new string where all the alphabetic characters are converted to upp...
evol_instruct_66k
6,299
Write a Python function to compute the sum of the largest contiguous sub-array within a given array of integers. The function should also identify and return the start and end indices of this sub-array. Additionally, the function should be able to handle edge cases, such as when all integers in the array are negative. ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def max_subarray_sum(arr: List[int]) -> Tuple[int, int, int]: """ Computes the sum of the largest contiguous sub-array within a given array of integers. Also identifies and returns the start a...
evol_instruct_66k
6,305
Write a Python function to calculate the average of three given integer numbers and the area of a circle given its radius. The function should handle erroneous input and return appropriate error messages. The code should start with: ```python from typing import Union, Tuple import math def calculate_values(a: Union[in...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Union, Tuple import math def calculate_values(a: Union[int, float], b: Union[int, float], c: Union[int, float], r: Union[int, float]) -> Tuple[Union[float, str], Union[float, str]]: """ Calculate the average ...
evol_instruct_66k
6,306
Write a Python function to create a 3D cubic tensor of dimensions 64x64x64, where each element is initialized to a specified value. The function should return the created tensor. The code should start with: ```python import numpy as np def create_3d_tensor(value: int) -> np.ndarray: ```
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def create_3d_tensor(value: int) -> np.ndarray: """ Create a 3D cubic tensor of dimensions 64x64x64, where each element is initialized to the specified value. Args: value (int): The value to init...