source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
evol_instruct_66k
14,755
Write a Python function to generate a new list that contains only the positive integers from a given list of integers. The function should handle any list of integers, including empty lists and lists with no positive integers. The code should start with: ```python from typing import List def filter_positive_integers(a...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def filter_positive_integers(arr: List[int]) -> List[int]: """ Generates a new list containing only the positive integers from the given list. Args: arr (List[int]): The list of integers f...
evol_instruct_66k
14,777
Write a Python function to determine if any string in a given list starts with a specified character. The function should return `True` if at least one string in the list starts with the specified character, and `False` otherwise. The function should be case-insensitive, meaning it should consider both uppercase and lo...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def any_string_starts_with(lst: List[str], char: str) -> bool: """ Determines if any string in the given list starts with the specified character. Args: lst (List[str]): The list of strings ...
evol_instruct_66k
14,786
Write a Python function to find the index of the first occurrence of a number within a specified range in a list of floating-point numbers. If no number within the range is found, the function should return -1. The code should start with: ```python from typing import List, Tuple def find_first_in_range(nums: List[flo...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_first_in_range(nums: List[float], range: Tuple[float, float]) -> int: """ Find the index of the first occurrence of a number within a specified range in a list of floating-point numbers. ...
evol_instruct_66k
14,798
Write a Python function to transform a list of dictionaries, where each dictionary contains `id` and `name` properties, into a single dictionary where the keys are the `id` values and the values are the corresponding `name` values. The function should handle cases where the input list is empty or contains duplicate `id...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def transform_data(data: List[Dict[int, str]]) -> Dict[int, str]: """ Transforms a list of dictionaries, where each dictionary contains 'id' and 'name' properties, into a single dictionary wher...
evol_instruct_66k
14,805
Write a Python function to find the nth alphabetic character in a given sequence of alphanumeric characters, ignoring non-alphabetic characters. The function should return the nth alphabetic character or `None` if there are fewer than n alphabetic characters in the sequence. The code should start with: ```python def f...
Here is the Python code to solve the given problem in the markdown block: ```python def find_nth_alphabetic_char(sequence: str, n: int) -> str: """ Find the nth alphabetic character in a given sequence of alphanumeric characters, ignoring non-alphabetic characters. Args: sequence (str): The sequenc...
evol_instruct_66k
14,817
Write a Python function to sort a given list of integers in ascending order using the QuickSort algorithm. The function should take a list of integers as input and return the sorted list. The code should start with: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: """ Sorts a list of integers in ascending order using the QuickSort algorithm. Args: arr (List[int]): The list of integers to be sorted. Retu...
evol_instruct_66k
14,823
Write a Python function to remove all empty strings from a given list of strings. The function should return a new list that contains only the non-empty strings from the original list. The code should start with: ```python from typing import List def remove_empty_strings(strings: List[str]) -> List[str]: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def remove_empty_strings(strings: List[str]) -> List[str]: """ Removes all empty strings from the given list of strings. Args: strings (List[str]): The list of strings from which to remove...
evol_instruct_66k
14,830
Write a Python function to determine if the first array contains at least one element from the second array. The function should handle 2D arrays and maintain a time complexity of O(n log n). The function should return `False` if the first array does not contain any element from the second array. The code should start...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def contains_element(A: List[List[int]], B: List[List[int]]) -> bool: """ Determines if the first 2D array contains at least one element from the second 2D array. Args: A (List[List[int]]): ...
evol_instruct_66k
14,854
Write a Python function to extend a given string by repeatedly adding a specified character to the beginning of the string until the string reaches a specified minimum length. The function should handle cases where the minimum length is less than or equal to the original string length by returning the original string u...
Here is the Python code to solve the given problem in the markdown block: ```python def extend_string_to_min_length(s: str, min_len: int, char: str) -> str: """ Extends the given string by adding a specified character to the beginning of the string until the string reaches a specified minimum length. A...
evol_instruct_66k
14,857
Write a Python function to convert each item in a given list to a float. The function should handle both numeric strings and non-numeric strings. If an item cannot be converted to a float, it should be replaced with `None`. The function should start with: ```python from typing import List, Union def convert_list_to_fl...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List, Union def convert_list_to_float(input_list: List[str]) -> List[Union[float, None]]: """ Converts each item in the input list to a float. If an item cannot be converted, it is replaced with None. ...
evol_instruct_66k
14,877
Write a Python function to reverse the order of all elements in a given list and convert each element to lowercase. The function should take a list of strings as input and return a new list with the elements in reverse order and each element converted to lowercase. 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 reverse_and_lowercase(arr: List[str]) -> List[str]: """ Reverses the order of all elements in the given list and converts each element to lowercase. Args: arr (List[str]): The list of st...
evol_instruct_66k
14,884
Write a Python function to merge two sorted lists into a single sorted list without using any built-in sort functions. The function should perform the operation with an optimal time complexity. The code should start with: ```python from typing import List def merge_sorted_lists(list1: List[int], list2: List[int]) -> L...
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 sorted lists into a single sorted list without using any built-in sort functions. Args: list1 (List[in...
evol_instruct_66k
14,889
Write a Python function to generate the first 50 elements of the Fibonacci series using a recursive strategy without using any inbuilt Python functions or loops. The function should return a list containing the Fibonacci sequence without duplicates. The code should start with: ```python def generate_fibonacci_sequence...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_fibonacci_sequence(n: int) -> list: """ Generate the first n elements of the Fibonacci series using a recursive strategy. Args: n (int): The number of Fibonacci elements to generate. Returns: ...
evol_instruct_66k
14,895
Write a Python function to generate a list of prime numbers up to 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 from typing import List def generate_primes_up_to_n(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_primes_up_to_n(n: int) -> List[int]: """ Generate a list of prime numbers up to a given number n using the Sieve of Eratosthenes algorithm. Args: n (int): The upper limit up to ...
evol_instruct_66k
14,901
Write a Python function to recursively count the total number of elements in a nested dictionary. Each key-value pair in the dictionary should be counted as one element. If a value is itself a dictionary, the function should recursively count the elements in that sub-dictionary. The function should handle cases where t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Any def count_nested_elements(dictionary: Dict[str, Any]) -> int: """ Recursively counts the total number of elements in a nested dictionary. Args: dictionary (Dict[str, Any]): The dictiona...
evol_instruct_66k
14,902
Write a Python function to calculate the cumulative sum of elements in a given list of integers. The cumulative sum at each position `i` in the list should be the sum of all elements from the start of the list up to and including the element at position `i`. 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 def cumulative_sum(nums: List[int]) -> List[int]: """ Calculate the cumulative sum of elements in a given list of integers. Args: nums (List[int]): The list of integers for which to calculat...
evol_instruct_66k
14,913
Write a Python function to reverse the initial mappings of a dictionary, causing the initial keys to transform into values and the original values to assume the position of keys. The function should handle cases where the original dictionary may contain duplicate values, ensuring that the reversed dictionary contains u...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def reverse_dictionary(dictionary: Dict[int, str]) -> Dict[str, int]: """ Reverses the mappings of a dictionary, causing the initial keys to transform into values and the original values to assume th...
evol_instruct_66k
14,917
Write a Python function to calculate the cumulative sum of all integer values present within a provided multi-layered dictionary. The dictionary may contain other dictionaries, lists, and integer values. The function should traverse through the nested structures and sum all integer values encountered. The function shou...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Union, List, Dict def cumulative_sum_nested_dict(dic: Union[Dict, List, int]) -> int: """ Calculate the cumulative sum of all integer values in a multi-layered dictionary. Args: dic (Union[Dict, ...
evol_instruct_66k
14,918
Write a Python function to check if a given value exists in a multidimensional array and to count how many times the value appears. The function should return a tuple containing a boolean indicating whether the value is present and an integer representing the count of occurrences. 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, Tuple def check_value_in_array(array: List[List[int]], value: int) -> Tuple[bool, int]: """ Check if a given value exists in a multidimensional array and count its occurrences. Args: array ...
evol_instruct_66k
14,931
Write a Python function to replace all instances of specified words in a given string with their corresponding replacements. The function should handle multiple replacements efficiently. The code should start with: ```python from typing import Dict def replace_words(original: str, replacements: Dict[str, str]) -> str:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def replace_words(original: str, replacements: Dict[str, str]) -> str: """ Replaces all instances of specified words in a given string with their corresponding replacements. Args: original (...
evol_instruct_66k
14,945
Write a Python function to calculate the Euclidean distance between two points in an n-dimensional space. The function should handle points with any number of dimensions and ensure that both points have the same dimensions. The code should start with: ```python from typing import List import math def euclidean_distanc...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math def euclidean_distance(point1: List[float], point2: List[float]) -> float: """ Calculate the Euclidean distance between two points in an n-dimensional space. Args: point1 (List[f...
evol_instruct_66k
14,950
Write a Python function to generate a two-dimensional matrix with specific dimensions and properties. The matrix should have exactly two horizontal dataset clusters and four distinct vertical dataset clusters, all filled with random integer values within a specified range. The function should return the generated matri...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def generate_matrix(num_rows: int, num_cols: int, min_value: int, max_value: int) -> np.ndarray: """ Generates a two-dimensional matrix with specified dimensions and filled with random integer values. Ar...
evol_instruct_66k
14,957
Write a Python function to determine if a given year is a leap year according to the rules of the Gregorian calendar. The function should return `True` if the year is a leap year and `False` otherwise. The code should start with: ```python def is_leap_year(year: int) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python def is_leap_year(year: int) -> bool: """ Determine if a given year is a leap year according to the rules of the Gregorian calendar. Args: year (int): The year to check. Returns: bool: True if the year i...
evol_instruct_66k
14,973
Write a Python function to sort a 2D array in ascending order based on the values in the second column. The function should handle any 2D array of integers. The code should start with: ```python from typing import List def sort_2d_array_by_second_column(arr: List[List[int]]) -> List[List[int]]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sort_2d_array_by_second_column(arr: List[List[int]]) -> List[List[int]]: """ Sorts a 2D array in ascending order based on the values in the second column. Args: arr (List[List[int]]): Th...
evol_instruct_66k
14,981
Write a Python function to count the occurrences of each distinct character in a given string. The function should return a dictionary where the keys are the characters and the values are their respective counts. The code should start with: ```python from typing import Dict def count_character_occurrences(string: str)...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def count_character_occurrences(string: str) -> Dict[str, int]: """ Count the occurrences of each distinct character in the given string. Args: string (str): The input string to analyze. ...
evol_instruct_66k
14,996
Write a Python function to reverse a given string using a stack data structure. The function should handle strings with alphanumeric characters, special characters, and white spaces. Additionally, optimize the solution considering time and space complexity. The code should start with: ```python def reverse_string(input...
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 using a stack data structure. Args: input_str (str): The string to be reversed. Returns: str: The reversed string. """ # ...
evol_instruct_66k
15,015
Write a Python function to generate a list of 15 distinct documents representing historical monuments, each with a unique identifier and specific fields. The function should return a list of dictionaries, where each dictionary represents a document with the following fields: `_id`, `name`, `location`, `year_built`, `ar...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def generate_monument_documents() -> List[Dict[str, str]]: """ Generates a list of 15 distinct documents representing historical monuments. Each document is a dictionary with the following fie...
evol_instruct_66k
15,031
Write a Python function to implement the selection sort algorithm. The function should take a list of integers as input and return the sorted list in ascending order. The selection sort algorithm works by repeatedly finding the minimum element from the unsorted part of the list and putting it at the beginning. The code...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def selection_sort(lst: List[int]) -> List[int]: """ Sorts a list of integers in ascending order using the selection sort algorithm. Args: lst (List[int]): The list of integers to be sorte...
evol_instruct_66k
15,041
Write a Python function to raise each element of a given matrix to the power of 3. The matrix is represented as a list of lists, where each inner list represents a row in the matrix. The function should return a new matrix with each element cubed. The code should start with: ```python from typing import List def cube...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def cube_matrix(matrix: List[List[int]]) -> List[List[int]]: """ Raises each element of the given matrix to the power of 3. Args: matrix (List[List[int]]): A 2D list representing the matrix....
evol_instruct_66k
15,058
Write a Python function to perform integer division of two numbers and return the result as an integer. The function should handle the case where the divisor is zero by returning a special value, such as `-1`, to indicate an error. The code should start with: ```python def integer_division(dividend: int, divisor: int) ...
Here is the Python code to solve the given problem in the markdown block: ```python def integer_division(dividend: int, divisor: int) -> int: """ Perform integer division of two numbers and return the result as an integer. If the divisor is zero, return -1 to indicate an error. Args: dividend (...
evol_instruct_66k
15,059
Write a Python function to count the frequency of each character in a given string and return the result as a dictionary. The dictionary should map each unique character to the number of times it appears in the string. The function should be case-sensitive, meaning 'A' and 'a' should be considered different characters....
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def character_frequency(text: str) -> Dict[str, int]: """ Counts the frequency of each character in the given string and returns a dictionary where each key is a unique character and the correspondin...
evol_instruct_66k
15,065
Write a Python function to transform yes/no inquiries into binary input. The function should handle multiple-step reasoning, such as converting user responses to a standardized format and then mapping these responses to binary values. The function should also handle case insensitivity and variations in user responses (...
Here is the Python code to solve the given problem in the markdown block: ```python def yes_no_to_binary(answer: str) -> int: """ Transforms a yes/no inquiry into a binary input. Args: answer (str): The user's response to a yes/no question. Returns: int: The binary representation of th...
evol_instruct_66k
15,080
Write a Python function to compare two numerical entities, `object1` and `object2`, and return a ternary result: `0` if they are equal, `-1` if `object1` is less than `object2`, and `1` if `object1` is greater than `object2`. The function should handle any numerical input, including integers and floating-point numbers....
Here is the Python code to solve the given problem in the markdown block: ```python def compare_objects(object1: float, object2: float) -> int: """ Compares two numerical entities and returns a ternary result. Args: object1 (float): The first numerical entity to compare. object2 (float): Th...
evol_instruct_66k
15,089
Write a Python function to fix a faulty dictionary by adding any missing key-value pairs and then calculate the total number of elements in the dictionary. The function should ensure that all required keys are present in the dictionary, using default values if necessary. The function should start with: ```python from t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def fix_and_count_elements(dictionary: Dict[str, any]) -> int: """ Fixes a faulty dictionary by adding any missing key-value pairs and calculates the total number of elements. Args: dictiona...
evol_instruct_66k
15,105
Write a Python function to generate and return a new matrix where every individual integer in the given matrix has been multiplied by a factor of 'n', where 'n' is a non-zero integer provided by the user. The function should be capable of handling matrices of varying sizes, including both square and non-square matrices...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def multiply_matrix_by_factor(matrix: List[List[int]], n: int) -> List[List[int]]: """ Generates and returns a new matrix where every individual integer in the given matrix has been multiplied by a f...
evol_instruct_66k
15,108
Write a Python function to convert a hexadecimal input (string) to its octal representation (string). The function should handle both uppercase and lowercase hexadecimal digits and return the octal representation as a string without the '0o' prefix. The code should start with: ```python def hex_to_octal(h: str) -> str...
Here is the Python code to solve the given problem in the markdown block: ```python def hex_to_octal(h: str) -> str: """ Convert a hexadecimal input (string) to its octal representation (string). Args: h (str): The hexadecimal string to be converted. Returns: str: The octal representat...
evol_instruct_66k
15,113
Write a Python function to compute the component-by-component product of two one-dimensional arrays. The function should ensure that both arrays have the same length before performing the computation. If the arrays do not have the same length, the function should return an error message. The code should start with: ```...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def component_product(arr1: List[int], arr2: List[int]) -> Union[List[int], str]: """ Computes the component-by-component product of two one-dimensional arrays. Args: arr1 (List[int])...
evol_instruct_66k
15,114
Write a Python function to create a nested dictionary from a list of key pairs. Each key pair consists of a main key and a subkey. The nested dictionary should have the main key pointing to a dictionary that contains the subkey with a default value of `None`. The code should start with: ```python from typing import Li...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def create_nested_dict(keys: List[Tuple[str, str]]) -> Dict[str, Dict[str, None]]: """ Creates a nested dictionary from a list of key pairs. Args: keys (List[Tuple[str, str]]): ...
evol_instruct_66k
15,124
Write a Python function to replace all occurrences of a given substring with an alternate substring in a given text. The function should handle cases where the target substring is not found in the text and should return the original text in such cases. The function should also handle cases where the target substring is...
Here is the Python code to solve the given problem in the markdown block: ```python def replace_substring(text: str, target: str, replacement: str) -> str: """ Replace all occurrences of a given substring with an alternate substring in the given text. Args: text (str): The original text in which th...
evol_instruct_66k
15,132
Write a Python function to extract the domain section from an email address. The email address is in the format `username@domain.com`. The function should handle various valid email formats and return the domain part of the email address. The code should start with: ```python def extract_domain(email: str) -> str: ```...
Here is the Python code to solve the given problem in the markdown block: ```python def extract_domain(email: str) -> str: """ Extracts the domain section from an email address. Args: email (str): The email address from which to extract the domain. Returns: str: The domain part of the ...
evol_instruct_66k
15,134
Write a Python function to find the sum of the squares of all even numbers in a given list of integers. The function should return the sum as an integer. The code should start with: ```python from typing import List def sum_of_squares_of_evens(numbers: 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_squares_of_evens(numbers: List[int]) -> int: """ Calculate the sum of the squares of all even numbers in the given list. Args: numbers (List[int]): A list of integers. Retu...
evol_instruct_66k
15,150
Write a Python function to calculate the moving average of a given time series data over a specified window size. The function should handle edge cases such as when the window size is larger than the length of the time series data. The code should start with: ```python from typing import List def moving_average(time_...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def moving_average(time_series: List[float], window_size: int) -> List[float]: """ Calculate the moving average of a given time series data over a specified window size. Args: time_series (L...
evol_instruct_66k
15,156
Write a Python function to classify an email as "spam" or "not spam" based on a predefined list of spam keywords. The function should use regular expressions to search for these keywords in the email content. If any keyword is found, the email should be classified as "spam". Otherwise, it should be classified as "not s...
Here is the Python code to solve the given problem in the markdown block: ```python import re from typing import List def classify_email(email: str, spam_keywords: List[str]) -> str: """ Classify an email as "spam" or "not spam" based on a list of spam keywords. Args: email (str): The content of t...
evol_instruct_66k
15,168
Write a Python function to determine if two given strings are mutual anagrams. The function should handle case insensitivity and ignore spaces. The function should also handle edge cases such as empty strings, non-string inputs, and strings with different lengths. The code should start with: ```python def are_anagrams...
Here is the Python code to solve the given problem in the markdown block: ```python def are_anagrams(string1: str, string2: str) -> bool: """ Determines if two given strings are mutual anagrams, ignoring case and spaces. Args: string1 (str): The first string to compare. string2 (str): The s...
evol_instruct_66k
15,176
Write a Python function to generate the nth Fibonacci number using memoization technique. The function should efficiently compute the Fibonacci number by storing previously computed values in a dictionary to avoid redundant calculations. The code should start with: ```python def fibonacci_memoized(n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def fibonacci_memoized(n: int) -> int: """ Calculate the nth Fibonacci number using memoization technique. Args: n (int): The position in the Fibonacci sequence to compute. Returns: int: The nth Fibonac...
evol_instruct_66k
15,183
Write a Python function to implement an ascending control structure that starts from the value -10 and terminates upon reaching the value of 10. For each negative number in this range, the function should multiply it by -2 before printing. Positive numbers and zero should be printed directly. The code should start wit...
Here is the Python code to solve the given problem in the markdown block: ```python def ascending_control_structure(): """ Implements an ascending control structure that starts from -10 and ends at 10. For each negative number in this range, it multiplies the number by -2 before printing. Positive numbe...
evol_instruct_66k
15,188
Write a Python function to convert a given date string from one format to another specified format. The function should handle multiple date formats and raise an error if the desired format is not supported. The code should start with: ```python from datetime import datetime def convert_date_format(date: str, input_f...
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, input_format: str, desired_format: str) -> str: """ Converts a given date string from one format to another specified format. Args: date (str): The d...
evol_instruct_66k
15,197
Write a Python function to merge two lists into a dictionary, where one list acts as the keys and the other as the values. The function should handle cases where the lengths of the two lists are not equal. If the keys list is longer, the extra keys should be ignored. If the values list is longer, the extra values shoul...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def merge_lists_to_dict(keys: List[str], values: List[int]) -> Dict[str, int]: """ Merges two lists into a dictionary, where the first list acts as the keys and the second list acts as the values. ...
evol_instruct_66k
15,198
Write a Python function to sort words in a dictionary based on the number of meanings each word has. The dictionary is provided in the format where each key is a word and the value is a list of meanings. The function should return a list of words sorted by the number of meanings in ascending order by default, but it sh...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Union def sort_words_by_meanings(dictionary: Dict[str, List[str]], reverse: bool = False) -> List[str]: """ Sorts the words in the given dictionary based on the number of meanings each word has. ...
evol_instruct_66k
15,203
Write a Python function to insert an element into a list at a specified index. The function should handle edge cases such as inserting at the beginning or end of the list, and should not modify the original list. Instead, it should return a new list with the element inserted at the specified index. The code should sta...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def insert_element_at_index(lst: List[int], index: int, element: int) -> List[int]: """ Inserts an element into a list at a specified index without modifying the original list. Args: lst (Li...
evol_instruct_66k
15,204
Write a Python function to translate a given string into its binary representation, where each character is represented by an 8-bit binary code. The function should return a single string where each binary code is separated by a space. The code should start with: ```python def string_to_binary(s: str) -> 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 an 8-bit binary code. Args: s (str): The input string to be translated into b...
evol_instruct_66k
15,209
Write a Python function to eliminate superfluous inter-spaces within a given sentence while maintaining a uniform single space between each word. The function should also ensure that the sentence starts and ends with a word, not a space. The code should start with: ```python def clean_sentence(sentence: str) -> str: ``...
Here is the Python code to solve the given problem in the markdown block: ```python def clean_sentence(sentence: str) -> str: """ Eliminates superfluous inter-spaces within a given sentence while maintaining a uniform single space between each word. Args: sentence (str): The input sentence with pot...
evol_instruct_66k
15,212
Write a Python function to perform a depth-first traversal on a given graph data structure using a stack-based approach. The graph is represented as an adjacency list. The function should return a list of nodes in the order they were visited during the traversal. The code should start with: ```python from typing impor...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Union def depth_first_traversal(graph: Dict[str, List[str]], root: str) -> List[str]: """ Perform a depth-first traversal on a graph represented as an adjacency list. Args: graph (Dic...
evol_instruct_66k
15,215
Write a Python function to calculate the frequency of each word in a given text fragment. The function should return a dictionary where the keys are the words and the values are the counts of those words in the text. The function should be case-insensitive, meaning "Word" and "word" should be considered the same word. ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def word_frequency(text: str) -> Dict[str, int]: """ Calculate the frequency of each word in a given text fragment. Args: text (str): The text fragment from which to calculate word frequenci...
evol_instruct_66k
15,216
Write a Python function to determine if a given string can be rearranged to form a palindrome. A palindrome reads the same forwards and backwards. The function should ignore spaces and be case-insensitive. The code should start with: ```python def can_form_palindrome(s: str) -> bool: ```
Here is the Python code to solve the given problem in the markdown block: ```python def can_form_palindrome(s: str) -> bool: """ Determines if a given string can be rearranged to form a palindrome. Args: s (str): The input string to check. Returns: bool: True if the string can be rearr...
evol_instruct_66k
15,221
Write a Python function to calculate the total distance between all occurrences of a specific element within a sorted array. The function should return the sum of the distances between consecutive occurrences of the element. If the element occurs less than twice, the function should return 0. The code should start wit...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def total_distance_between_elements(arr: List[int], elem: int) -> int: """ Calculate the total distance between all occurrences of a specific element within a sorted array. Args: arr (List...
evol_instruct_66k
15,224
Write a Python function to determine if a given array of strings is in alphabetical order. Additionally, implement a function to randomly shuffle the elements of the array. The code should start with: ```python from typing import List import random def is_alphabetical(array: List[str]) -> bool: """ Determine i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def is_alphabetical(array: List[str]) -> bool: """ Determine if the given array of strings is in alphabetical order. Args: array (List[str]): The array of strings to check. ...
evol_instruct_66k
15,226
Write a Python function to efficiently separate prime numbers and composite numbers from a given list of integers. The function should return two lists: one containing the prime numbers and the other containing the composite numbers. The function should be optimized for performance, especially for large input sizes. T...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple import math def separate_primes_and_composites(input_list: List[int]) -> Tuple[List[int], List[int]]: """ Separates prime numbers and composite numbers from a given list of integers. Args: ...
evol_instruct_66k
15,237
Write a Python function to generate and print the Fibonacci sequence up to but not including a given number `limit`. The function should start with: ```python def print_fibonacci_sequence(limit: int): ```
Here is the Python code to solve the given problem in the markdown block: ```python def print_fibonacci_sequence(limit: int): """ Generates and prints the Fibonacci sequence up to but not including the given limit. Args: limit (int): The upper limit for the Fibonacci sequence. Returns: ...
evol_instruct_66k
15,238
Write a Python function to extract all valid email addresses from a given piece of text using regular expressions. The function should correctly handle various email formats and ensure that the extracted email addresses are valid. The code should start with: ```python import re def extract_emails(text: str) -> list: `...
Here is the Python code to solve the given problem in the markdown block: ```python import re def extract_emails(text: str) -> list: """ Extracts all valid email addresses from a given piece of text using regular expressions. Args: text (str): The text from which to extract email addresses. R...
evol_instruct_66k
15,239
Write a Python function to implement a binary search algorithm that finds the index of a target element in a sorted array. If the element is not found, return -1. The function should be efficient and handle edge cases such as an empty array or a target element that is not in the array. The code should start with: ```p...
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: """ Perform a binary search to find the index of the target element in a sorted array. Args: arr (List[int]): A sorted list of integers...
evol_instruct_66k
15,250
Write a Python function to generate an array containing exactly five distinct integers that fall within the numerical range of 1 to 15. The function should ensure that the integers are unique and within the specified range. The code should start with: ```python from typing import List import random def generate_distin...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def generate_distinct_integers() -> List[int]: """ Generates an array containing exactly five distinct integers within the range of 1 to 15. Returns: List[int]: A list containi...
evol_instruct_66k
15,251
Write a Python function to extract and separate every comment included within a particular fragment of Python programming code. The function should return a list of strings, where each string is a comment found in the code. The code should start with: ```python from typing import List import re def extract_comments(py...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List import re def extract_comments(python_code: str) -> List[str]: """ Extracts all comments from a given Python code snippet. Args: python_code (str): The Python code snippet from which to ex...
evol_instruct_66k
15,265
Write a Python function to count the number of trailing zeros in the binary representation of the factorial of a given number `n`. The function should efficiently compute the factorial and then determine the number of trailing zeros in its binary representation. The code should start with: ```python def count_trailing...
Here is the Python code to solve the given problem in the markdown block: ```python def count_trailing_zeros_in_factorial_binary(n: int) -> int: """ Count the number of trailing zeros in the binary representation of the factorial of a given number n. Args: n (int): The number to compute the factori...
evol_instruct_66k
15,294
Write a Python function to implement the Cocktail Shaker Sort algorithm, which sorts an array in ascending order. The function should start with: ```python from typing import List def cocktail_shaker_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 cocktail_shaker_sort(arr: List[int]) -> List[int]: """ Sorts the given array in ascending order using the Cocktail Shaker Sort algorithm. Args: arr (List[int]): The array to be sorted. ...
evol_instruct_66k
15,295
Write a Python function to create a dictionary where each key is a distinct floating-point number from a given list, and the corresponding value is its multiplicative reciprocal. The function should handle the case where the floating-point number is zero by skipping it to avoid division by zero. The code should start ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def create_reciprocal_dict(float_list: List[float]) -> Dict[float, float]: """ Create a dictionary where each key is a distinct floating-point number from the given list, and the corresponding ...
evol_instruct_66k
15,299
Write a Python function to find the second smallest value among four given integers. The function should handle negative numbers and zero, and it should be optimized to avoid unnecessary comparisons. The code should start with: ```python def second_smallest(x1: int, x2: int, x3: int, x4: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def second_smallest(x1: int, x2: int, x3: int, x4: int) -> int: """ Find the second smallest value among four given integers. Args: x1 (int): The first integer. x2 (int): The second integer. x3 (int)...
evol_instruct_66k
15,329
Write a Python function to print all integers within a given range, excluding specific numbers. The function should take three parameters: the start of the range, the end of the range (inclusive), and a list of numbers to exclude. The function should print each number in the range that is not in the exclusion list. Th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def print_numbers_in_range_excluding(start: int, end: int, exclude: List[int]) -> None: """ Prints all integers within a given range, excluding specific numbers. Args: start (int): The start...
evol_instruct_66k
15,334
Write a Python function to count the frequency of elements in a given list and sort the resulting dictionary by its values in descending order. The function should not use built-in functions like `collections.Counter` or `sorted`. Instead, implement the counting and sorting logic manually. 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 count_and_sort_frequencies(arr: List[int]) -> Dict[int, int]: """ Counts the frequency of each element in the given list and returns a dictionary sorted by the frequencies in descending order. ...
evol_instruct_66k
15,345
Write a Python function to filter out and return a list containing only the even numbers from a given list of integers. The function should handle various edge cases, such as an empty list, a list with no even numbers, and a list with all even numbers. The function should be implemented using a loop and conditional sta...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def filter_even_numbers(lst: List[int]) -> List[int]: """ Filters and returns a list containing only the even numbers from the given list of integers. Args: lst (List[int]): The list of inte...
evol_instruct_66k
15,366
Write a Python function to transpose a given 2-dimensional array (matrix). The transpose of a matrix is obtained by swapping its rows with its columns. The function should handle matrices of any size, including non-square matrices. The code should start with: ```python from typing import List def transpose_matrix(mat...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def transpose_matrix(matrix: List[List[int]]) -> List[List[int]]: """ Transposes a given 2-dimensional array (matrix). Args: matrix (List[List[int]]): The input matrix to be transposed. ...
evol_instruct_66k
15,384
Write a Python function to fetch and print the current prices of Bitcoin and Ethereum using the CoinMarketCap API. The function should handle the API request, parse the response, and print the prices in a formatted manner. The code should start with: ```python import requests def fetch_crypto_prices(api_key: str) -> N...
Here is the Python code to solve the given problem in the markdown block: ```python import requests def fetch_crypto_prices(api_key: str) -> None: """ Fetches and prints the current prices of Bitcoin and Ethereum using the CoinMarketCap API. Args: api_key (str): The API key for authentication with...
evol_instruct_66k
15,415
Write a Python function to find the second, third, and fourth smallest unique numbers in a given multi-dimensional array. The dimensions of the internal arrays can be uneven. If the array does not contain enough unique numbers, return a specific message indicating that. The code should start with: ```python from typin...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union import heapq def find_second_third_fourth_smallest(arr: List[List[int]]) -> Union[List[int], str]: """ Finds the second, third, and fourth smallest unique numbers in a given multi-dimensional arra...
evol_instruct_66k
15,417
Write a Python function to reverse the order of elements in a given tuple of integers without using any built-in functions (e.g., `reversed()`, `.reverse()`). Additionally, implement a mechanism that checks if the tuple elements are all integers. If they are not, the function should raise a `ValueError`. The code shou...
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_tuple(t: tuple) -> tuple: """ Reverses the order of elements in a given tuple of integers without using built-in functions. Raises a ValueError if the input is not a tuple or if any element in the tuple is not an...
evol_instruct_66k
15,434
Write a Python function to determine if at least one element from the first array (`array1`) is present in the second array (`array2`). If such an element exists, the function should return `True`; otherwise, it should return `False`. The code should start with: ```python from typing import List def has_common_elemen...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def has_common_element(array1: List[int], array2: List[int]) -> bool: """ Determines if there is at least one common element between two arrays. Args: array1 (List[int]): The first array to ...
evol_instruct_66k
15,438
Write a Python function to calculate the cumulative total of only the prime numbers present in a given numeric array. The function should be able to handle any list of integers, not just the predefined list. The code should start with: ```python from typing import List def sum_of_primes(numbers: List[int]) -> int: ``...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def is_prime(n: int) -> bool: """ Helper function to check if a number is prime. Args: n (int): The number to check for primality. Returns: bool: True if the number is prime, Fa...
evol_instruct_66k
15,458
Write a Python function to find and display all hidden files in a specific directory and also recursively find all hidden files in its subdirectories. Additionally, the function should check for the size of each hidden file and display a warning message if any file size exceeds 1MB. The code should start with: ```pyth...
Here is the Python code to solve the given problem in the markdown block: ```python import os def find_hidden_files_and_check_size(directory: str) -> None: """ Find and display all hidden files in a specific directory and its subdirectories. Additionally, check for the size of each hidden file and display ...
evol_instruct_66k
15,459
Write a Python function to calculate the maximum disparity between the smallest and largest elements across all possible sub-arrays of a given two-dimensional array. The function should return the maximum disparity found. The code should start with: ```python from typing import List def max_disparity_in_subarrays(two...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def max_disparity_in_subarrays(two_dim_array: List[List[int]]) -> int: """ Calculate the maximum disparity between the smallest and largest elements across all possible sub-arrays of a given two-dime...
evol_instruct_66k
15,481
Write a Python function to generate a unique, intricate string composed of a specific combination of eight alphanumeric entities that skillfully harmonizes a blend of both distinct alphabetic letters and numeric digits. The string must contain exactly two uppercase letters, two lowercase letters, two digits, and two sp...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random import string def generate_unique_string() -> str: """ Generates a unique, intricate string composed of exactly eight alphanumeric entities. The string contains exactly two uppercase le...
evol_instruct_66k
15,483
Write a Python function to obtain the mirror image, or reverse order, of an array constituted by integers. The function should efficiently reverse the order of elements in the array without using any built-in reverse functions or methods. The code should start with: ```python from typing import List def reverse_array(...
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def reverse_array(arr: List[int]) -> List[int]: """ Reverses the order of elements in the given array of integers. Args: arr (List[int]): The array of integers to be reversed. Returns...
evol_instruct_66k
15,488
Write a Python function to find the penultimate maximum value in a given list of integers. The penultimate maximum value is the second largest value in the list. The function should handle lists with at least two elements and should be efficient. The code should start with: ```python from typing import List def find_...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_penultimate_max(numbers: List[int]) -> int: """ Find the penultimate maximum value in a list of integers. Args: numbers (List[int]): A list of integers with at least two elements. ...
evol_instruct_66k
15,494
Write a Python function to determine the sum of all the odd elements in a given array of integers. The function must achieve this in less than O(n) time complexity. The code should start with: ```python from typing import List def sum_of_odd_elements(arr: 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_odd_elements(arr: List[int]) -> int: """ Calculate the sum of all odd elements in the given array of integers. Args: arr (List[int]): The array of integers from which to calcula...
evol_instruct_66k
15,503
Write a Python function to reverse the order of words in a given string without reversing the characters within each word. The function should not use any built-in string manipulation functions or methods. Additionally, implement error handling to return an appropriate message if the input is not a string. The code sh...
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_words_in_string(input_string: str) -> str: """ Reverses the order of words in a given string without reversing the characters within each word. Args: input_string (str): The input string to be processed....
evol_instruct_66k
15,506
Write a Python function to perform integer division of two integers without using the division, multiplication, or modulus operator. The function should handle edge cases such as division by zero and negative integers. The function should return both the quotient and the remainder. The code should start with: ```pytho...
Here is the Python code to solve the given problem in the markdown block: ```python def integer_division(dividend: int, divisor: int) -> tuple: """ Perform integer division of two integers without using the division, multiplication, or modulus operator. Handles edge cases such as division by zero and negati...
evol_instruct_66k
15,511
Write a Python function to encrypt a given text using the Caesar Cipher algorithm. The Caesar Cipher shifts each letter in the text by a specified number of positions down the alphabet. Non-alphabetic characters should remain unchanged. The function should handle both uppercase and lowercase letters. The code should s...
Here is the Python code to solve the given problem in the markdown block: ```python def caesar_cipher_encrypt(text: str, shift: int) -> str: """ Encrypts the given text using the Caesar Cipher algorithm. Args: text (str): The text to be encrypted. shift (int): The number of positions to shi...
evol_instruct_66k
15,535
Write a Python function to merge two arrays of strings, `digits1` and `digits2`, such that each element in the resulting array is a combination of one element from `digits1` and one element from `digits2`, repeated twice in sequence. The order of combination should be from the respective positions of the elements in th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_arrays(digits1: List[str], digits2: List[str]) -> List[str]: """ Merge two arrays of strings such that each element in the resulting array is a combination of one element from `digits1` and...
evol_instruct_66k
15,547
Write a Python function to identify identical elements present within two separate, sequentially ordered arrays. The function should not utilize any Python built-in functions for set operations or list manipulations. The function should start with: ```python from typing import List def find_common_elements(list1: List...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_common_elements(list1: List[int], list2: List[int]) -> List[int]: """ Identifies identical elements present within two separate, sequentially ordered arrays. Args: list1 (List[int])...
evol_instruct_66k
15,566
Write a Python function to merge two lists into a dictionary, ensuring that any additional keys in the longer list will have a value of `None` if there are no corresponding elements in the smaller list. The function should handle lists of unequal lengths without causing an error. The code should start with: ```python f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def merge_lists_to_dict(list1: List[str], list2: List[int]) -> Dict[str, int]: """ Merge two lists into a dictionary, ensuring that any additional keys in the longer list will have a value of N...
evol_instruct_66k
15,572
Write a Python function to calculate the sum of all elements in a given array of numbers. The function should handle arrays of integers and floating-point numbers. The code should start with: ```python from typing import List, Union def sum_of_array(array: List[Union[int, float]]) -> Union[int, float]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def sum_of_array(array: List[Union[int, float]]) -> Union[int, float]: """ Calculate the sum of all elements in a given array of numbers. Args: array (List[Union[int, float]]): The ar...
evol_instruct_66k
15,583
Write a Python function to compute the statistical mode of a given set of numeric values using the `numpy` library. The mode is the value that appears most frequently in the dataset. If there are multiple values with the same highest frequency, the function should return the first one encountered in the sorted list of ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import numpy as np def compute_mode(data: List[int]) -> int: """ Compute the statistical mode of a given set of numeric values. The mode is the value that appears most frequently in the dataset. If ...
evol_instruct_66k
15,596
Write a Python function to find the second smallest number in a given list of integers without using any built-in functions or sorting algorithms. Assume all numbers in the list are unique. The code should start with: ```python from typing import List def find_second_smallest(numbers: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_second_smallest(numbers: List[int]) -> int: """ Find the second smallest number in a list of unique integers without using built-in functions or sorting algorithms. Args: numbers (L...
evol_instruct_66k
15,604
Write a Python function to find and return the duplicate items in a given list of integers. The function should return a list of unique duplicate items in the order they appear first in the input list. The code should start with: ```python from typing import List def find_duplicates(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 find_duplicates(arr: List[int]) -> List[int]: """ Find and return the duplicate items in a given list of integers. Args: arr (List[int]): The list of integers to check for duplicates. ...
evol_instruct_66k
15,610
Write a Python function to generate the first `n` terms of the Fibonacci sequence as a list of integers. The function should handle edge cases such as `n` being 0 or 1. 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. Args: n (int): The number of terms to generate. Returns: List[int]: A list...
evol_instruct_66k
15,617
Write a Python function to create an NxN matrix filled with sequential numbers starting from 0 to N^2 - 1, rotate the matrix 90 degrees clockwise, and then check if the rotated matrix is symmetrical. The function should return `True` if the rotated matrix is symmetrical, otherwise `False`. 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 create_and_check_matrix(n: int) -> bool: """ Creates an NxN matrix filled with sequential numbers starting from 0 to N^2 - 1, rotates the matrix 90 degrees clockwise, and checks if the rotated ma...
evol_instruct_66k
15,622
Write a Python function to generate a list containing all multiples of 3 from 0 to a given number `n` using list comprehension. The function should be optimized for performance and clarity. The code should start with: ```python from typing import List def multiples_of_3(n: int) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def multiples_of_3(n: int) -> List[int]: """ Generate a list of all multiples of 3 from 0 to the given number `n`. Args: n (int): The upper limit (inclusive) for generating multiples of 3. ...
evol_instruct_66k
15,626
Write a Python function to find the first occurrence of a specified element in a given list, tuple, or string. If the element is not found, return -1. The function should handle lists, tuples, and strings as input. The code should start with: ```python from typing import Union def find_first_occurrence(data: Union[li...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Union def find_first_occurrence(data: Union[list, tuple, str], element) -> int: """ Find the first occurrence of a specified element in a given list, tuple, or string. Args: data (Union[list, tup...
evol_instruct_66k
15,627
Write a Python function to determine if a given string is an anagram of its reversed form, considering multiple words (strings separated by spaces) and ignoring case differences. The function should be recursive and handle the input string by progressively reducing it to its base case. The code should start with: ```p...
Here is the Python code to solve the given problem in the markdown block: ```python def is_reverse_anagram(text: str) -> bool: """ Determine if a given string is an anagram of its reversed form, considering multiple words and ignoring case differences. Args: text (str): The input string to check. ...
evol_instruct_66k
15,628
Write a Python function to create a dictionary containing the details of an employee. The function should accept four parameters: `name`, `date_of_joining`, `position`, and `employee_id`. The function should return a dictionary with keys "Name", "Date of Joining", "Position", and "Employee ID" corresponding to the prov...
Here is the Python code to solve the given problem in the markdown block: ```python def create_employee_details(name: str, date_of_joining: str, position: str, employee_id: str) -> dict: """ Creates a dictionary containing the details of an employee. Args: name (str): The name of the employee. ...
evol_instruct_66k
15,629
Write a Python function to recursively invert the numerical elements within a complex nested tuple data structure. The function should handle both integers and floating point numbers, and it should return the modified tuple. If a numerical element is zero, it should remain unchanged to avoid division by zero. The funct...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Union, Tuple def invert_nested_tuple(t: Union[Tuple, int, float]) -> Union[Tuple, int, float]: """ Recursively invert numerical elements within a nested tuple. Args: t (Union[Tuple, int, float]):...
evol_instruct_66k
15,634
Write a Python function to sort a given list of integers using the QuickSort algorithm. The function should be able to handle lists of any length, including empty lists and lists with duplicate elements. The code should start with: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def quicksort(arr: List[int]) -> List[int]: """ Sorts a list of integers using the QuickSort algorithm. Args: arr (List[int]): The list of integers to be sorted. Returns: List[i...