source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
python_sharegpt_23k
16,355
Write a Python function to generate a random simile and a random metaphor from predefined lists and print them to the console. The function should handle the case where the lists are empty by printing a default message. The code should start with: ```python from typing import List def generate_random_literary_devices(...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def generate_random_literary_devices(similes: List[str], metaphors: List[str]) -> None: """ Generates and prints a random simile and a random metaphor from the provided lists. Args: ...
python_sharegpt_23k
16,358
Write a Python function to implement a merge sort algorithm that can handle sorting of integers, strings, and floating-point numbers, including possible duplicates. The sorting should be stable and should not cause any loss of precision for floating-point numbers. 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 List, Union def merge_sort(arr: List[Union[int, float, str]]) -> List[Union[int, float, str]]: """ Sorts a list containing integers, strings, and floating-point numbers using the merge sort algorithm. Ar...
python_sharegpt_23k
16,367
Write a Python function to create a dictionary where each key is a word from a given list of words, and the corresponding value is the length of the word. The function should handle lists of varying lengths and ensure that the dictionary is correctly populated. The code should start with: ```python from typing import ...
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 where each key is a word from the given list and the corresponding value is the length of the word. Ar...
python_sharegpt_23k
16,371
Write a Python function to print categories from a dictionary in a specific order. The first row should contain categories grouped by their size, with larger categories on the left and smaller categories on the right. The second row should contain the remaining categories arranged alphabetically. Each category should b...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def print_categories_by_size_and_alphabet(categories: Dict[str, List[str]]) -> None: """ Prints categories from a dictionary in a specific order. The first row contains categories grouped by their ...
python_sharegpt_23k
16,379
Write a Python function to generate a dataset of puns in the specified format. The function should randomly select puns from predefined categories and return a list of dictionaries, where each dictionary contains a pun and its category. The function should allow specifying the number of puns to generate. The code shou...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict import random def generate_puns(num_puns: int) -> List[Dict[str, str]]: """ Generates a dataset of puns in the specified format. Args: num_puns (int): The number of puns to generate. ...
python_sharegpt_23k
16,381
Write a Python function to sort a list of movie dictionaries by their release year and display the title, budget, and country of origin for each movie. The function should only display movies with a budget of at least $5 million. The output should be formatted in a table with columns for the movie title, budget, and co...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def display_movies_by_release_date(movies: List[Dict[str, any]]) -> None: """ Sorts a list of movie dictionaries by their release year and displays the title, budget, and country of origin for ...
python_sharegpt_23k
16,384
Write a Python function to recommend books from each genre based on their publication date. The function should take a dictionary of books categorized by genre and a dictionary of publication dates as input. The output should be a dictionary where each genre contains a list of recommended books and a list of all books ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def recommend_books(books: Dict[str, List[str]], publication_dates: Dict[str, int]) -> Dict[str, Dict[str, List[str]]]: """ Recommends books from each genre based on their publication date. Ar...
python_sharegpt_23k
16,403
Write a Python function to reverse a given string. The function should take a string as input and return the reversed version of the string. The code should start with: ```python def reverse_string(string: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: : ```python def reverse_string(string: str) -> str: """ Reverses the given string. Args: string (str): The input string to be reversed. Returns: str: The reversed version of the input string. """ # Use sl...
python_sharegpt_23k
16,407
Write a Python function to generate a formal invitation for a networking event using Markdown syntax. The function should take event details as input parameters and return a formatted Markdown string. The event details include the event name, date and time, location, purpose, and RSVP instructions. The function should ...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_invitation(event_name: str, date_and_time: str, location: str, purpose: str, rsvp_email: str) -> str: """ Generates a formal invitation for a networking event using Markdown syntax. Args: event_name (st...
python_sharegpt_23k
16,411
Write a Python function to generate a standardized diagnostic report for a given neuropsychological syndrome. The function should take patient information (name and age), the date of the report, the diagnosis, a list of differential diagnoses, and the recommended treatment as inputs. The function should return a format...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import datetime def generate_diagnostic_report(patient_name: str, patient_age: int, date_today: datetime.date, diagnosis: str, differential_diagnosis: List[str], treatment: str) -> str: """ Generates a s...
python_sharegpt_23k
16,413
Write a Python function to group people by their age from a list of tuples. Each tuple contains a person's name and age. The function should return a dictionary where the keys are the unique ages and the values are lists of names of the people who have that age. The names within each age group should be sorted alphabet...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def group_people_by_age(people: List[Tuple[str, int]]) -> Dict[int, List[str]]: """ Groups people by their age from a list of tuples and returns a dictionary where the keys are the unique ag...
python_sharegpt_23k
16,420
Write a Python function to find the closest landmark to a given target landmark from a list of landmarks. The closest landmark is defined as the landmark with the smallest distance (in miles) to the target landmark. The distances between landmarks are provided in a dictionary where the keys are the names of the landmar...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def closest_landmark(target_landmark: str, landmark_list: List[str], landmark_distances: Dict[str, int]) -> str: """ Finds the closest landmark to a given target landmark from a list of landmarks. ...
python_sharegpt_23k
16,440
Write a Python function to generate a table containing the name, age, and musical instrument of each sibling from a list of dictionaries. Each dictionary represents a sibling and contains keys "name", "age", and "instrument". The function should return a formatted string representing the table. The code should start w...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def generate_sibling_table(siblings: List[Dict[str, str]]) -> str: """ Generates a formatted table containing the name, age, and musical instrument of each sibling. Args: siblings (Lis...
python_sharegpt_23k
16,441
Write a Python function to calculate the sum of all even numbers greater than 5 in a given list of numbers. The function should filter out the even numbers greater than 5, sum them, and return the total sum. The code should start with: ```python from typing import List def sum_of_even_numbers_greater_than_5(nums: Lis...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_of_even_numbers_greater_than_5(nums: List[int]) -> int: """ Calculate the sum of all even numbers greater than 5 in the given list. Args: nums (List[int]): A list of integers from wh...
python_sharegpt_23k
16,447
Write a Python function to evaluate the authenticity of a given sequence of parentheses, including different types of brackets such as square brackets, curly brackets, and angle brackets. The function should ensure that the brackets are balanced, properly nested, and not overlapping. The function should return `True` i...
Here is the Python code to solve the given problem in the markdown block: ```python def is_valid_parentheses(s: str) -> bool: """ Evaluates the authenticity of a given sequence of parentheses, including different types of brackets. Args: s (str): The sequence of parentheses to evaluate. Return...
python_sharegpt_23k
16,450
Write a Python function to find the second smallest number in a given list of integers. The function should be efficient and leverage the `heapq` module to achieve this. The code should start with: ```python from typing import List import heapq 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 import heapq def find_second_smallest(numbers: List[int]) -> int: """ Find the second smallest number in a given list of integers. Args: numbers (List[int]): The list of integers from which ...
python_sharegpt_23k
16,454
Write a Python function to filter a dictionary and return a new dictionary containing only the key-value pairs where the value is greater than or equal to a specified threshold. The function should start with: ```python from typing import Dict def filter_dict_by_threshold(input_dict: Dict[str, int], threshold: int) ->...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def filter_dict_by_threshold(input_dict: Dict[str, int], threshold: int) -> Dict[str, int]: """ Filters a dictionary to include only key-value pairs where the value is greater than or equal to a specifie...
python_sharegpt_23k
16,455
Write a Python function to generate a list of unique words using the structure "____-walk", where the first blank can be filled with any animal name from a predefined list and the second blank can be filled with any type of walk from another predefined list. The function should return the list of generated words in alp...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_unique_words(animals: List[str], walks: List[str]) -> List[str]: """ Generates a list of unique words using the structure "____-walk", where the first blank can be filled with any animal...
python_sharegpt_23k
16,458
Write a Python function to generate an HTML table that displays a list of fruits with their carbohydrate content sorted in descending order. The input is a list of dictionaries, where each dictionary contains the keys `"name"` and `"carbohydrates"`. The function should return a string containing the HTML table. The co...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def generate_html_table(fruits: List[Dict[str, any]]) -> str: """ Generates an HTML table that displays a list of fruits with their carbohydrate content sorted in descending order. Args: ...
python_sharegpt_23k
16,472
Write a Python function to calculate the sum of the first n positive integers and another function to calculate the sum of the first n even positive integers. The functions should be efficient and avoid unnecessary computations. The code should start with: ```python def sum_of_first_n_integers(n: int) -> int: ``` and ...
Here is the Python code to solve the given problem in the markdown block: ```python def sum_of_first_n_integers(n: int) -> int: """ Calculate the sum of the first n positive integers. Args: n (int): The number of positive integers to sum. Returns: int: The sum of the first n positive i...
python_sharegpt_23k
16,476
Write a Python function to reverse a given string. The function should handle strings of varying lengths, including empty strings. The function should be efficient and use Python's built-in capabilities to achieve the task. The code should start with: ```python def reverse_string(s: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_string(s: str) -> str: """ Reverses the given string. Args: s (str): The string to be reversed. Returns: str: The reversed string. """ # Use slicing to reverse the string return ...
python_sharegpt_23k
16,478
Write a Python function to generate a new list with unique elements from a given list of integers. The function should preserve the order of the first occurrence of each element. The code should start with: ```python from typing import List def unique_elements_ordered(lst: List[int]) -> List[int]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def unique_elements_ordered(lst: List[int]) -> List[int]: """ Generate a new list with unique elements from the given list of integers, preserving the order of their first occurrence. Args: ...
python_sharegpt_23k
16,482
Write a Python function to generate a list of numbers from 1 to 1000 (inclusive) following the "FizzBuzz" rules. The function should return a list where: - If a number is divisible by 3, append "Fizz" to the list. - If a number is divisible by 5, append "Buzz" to the list. - If a number is divisible by both 3 and 5, ap...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_fizzbuzz_list() -> List[str]: """ Generates a list of numbers from 1 to 1000 (inclusive) following the "FizzBuzz" rules. Returns: List[str]: A list where each element is either ...
python_sharegpt_23k
16,485
Write a Python function to implement the selection sort algorithm to sort a given array of numbers in descending order. Additionally, provide a detailed analysis of the time complexity of the algorithm in the form of Big-O notation, explaining the number of comparisons and swaps performed, considering the worst-case sc...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def selection_sort_descending(arr: List[int]) -> List[int]: """ Sorts the given array of numbers in descending order using the selection sort algorithm. Args: arr (List[int]): The array of n...
python_sharegpt_23k
16,488
Write a Python function to find the first string in a list that contains all the vowels (a, e, i, o, u) in order, and return its index along with the string. If no such string exists, return `-1` and print a warning message to the console. The function should have a time complexity of O(n). The code should start with:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_string_with_all_vowels(lst: List[str]) -> Tuple[int, str]: """ Find the first string in the list that contains all the vowels (a, e, i, o, u) in order, and return its index and the string...
python_sharegpt_23k
16,490
Write a Python function to generate a random story about a brave young girl and a villain. The function should create a plot and characters for the story, and then print the story in a structured format. The story should include a beginning, middle, and end, with plot points that describe the girl's journey and her int...
Here is the Python code to solve the given problem in the markdown block: ```python import random def generate_story(): """ Generates a random story about a brave young girl and a villain. The story includes a beginning, middle, and end, with plot points that describe the girl's journey and her interactio...
python_sharegpt_23k
16,508
Write a Python function to convert a given phrase into Pig Latin using a dictionary to map vowels and consonants. The function should handle cases where the first letter of the word is capitalized and output the result with the same capitalization. The function should also handle punctuation correctly by keeping it at ...
Here is the Python code to solve the given problem in the markdown block: ```python def convert_to_pig_latin(phrase: str) -> str: """ Converts a given phrase into Pig Latin using a dictionary to map vowels and consonants. Handles capitalization and punctuation correctly. Args: phrase (str): The...
python_sharegpt_23k
16,511
Write a Python function to search for the occurrence of the number 25 in an array of 10 integers, randomly generated between 20 to 30 inclusive. The function should return a boolean indicating whether the number 25 is present in the array. The code should start with: ```python from typing import List import random de...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def search_25_in_array() -> bool: """ Searches for the occurrence of the number 25 in an array of 10 integers, randomly generated between 20 to 30 inclusive. Returns: bool:...
python_sharegpt_23k
16,519
Write a Python function to generate 10 alternative endings for a given story by randomly selecting different events to occur. The function should replace specific phrases in the original ending with randomly chosen alternatives. The code should start with: ```python from typing import List import random def generate_a...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def generate_alternative_endings(original_ending: str) -> List[str]: """ Generates 10 alternative endings for a given story by randomly replacing specific phrases. Args: origin...
python_sharegpt_23k
16,529
Write a Python function to generate a meal plan based on the delivery location and business concept. The function should take two parameters: `delivery_location` (a string representing the delivery location) and `business_concept` (an integer representing the index of the business concept within the delivery location)....
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random # Define meal options for each business concept vegan_meals = ['Vegan chili with cornbread', 'Tofu stir-fry with brown rice', 'Vegan lasagna', 'Vegan lentil soup', 'Vegan black bean burgers'] paleo...
python_sharegpt_23k
16,531
Write a Python function to determine whether a given number is even or odd. The function should return a string indicating "Even" if the number is even and "Odd" if the number is odd. The code should start with: ```python def is_even_or_odd(number: int) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def is_even_or_odd(number: int) -> str: """ Determine whether the given number is even or odd. Args: number (int): The number to be checked. Returns: str: A string indicating "Even" if the number is eve...
python_sharegpt_23k
16,538
Write a Python function to calculate the total time taken by the teacher to explain all missed solutions and give extra problems, and the time taken by the student to solve the extra problems. The function should take the number of missed solutions and the number of extra problems as inputs and return the total time ta...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_total_time(missed_solutions: int, extra_problems: int) -> (int, int, int): """ Calculate the total time taken by the teacher to explain all missed solutions and give extra problems, and the time taken by the st...
python_sharegpt_23k
16,542
Write a Python function to calculate the nth number of the Fibonacci sequence using an optimized approach that reduces the time complexity compared to the naive recursive method. The function should use memoization to store previously computed Fibonacci numbers to avoid redundant calculations. The code should start wi...
Here is the Python code to solve the given problem in the markdown block: ```python def fibonacci(n: int, memo: dict = {}) -> int: """ Calculate the nth Fibonacci number using memoization to optimize performance. Args: n (int): The position in the Fibonacci sequence to calculate. memo (dict...
python_sharegpt_23k
16,556
Write a Python function to generate a sentence that includes the words 'mango', 'colossal', and 'section' in a specific order. The sentence should always start with 'A colossal mango', followed by 'section' in the middle, and end with 'was found in the'. The code should start with: ```python def generate_sentence() -> ...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_sentence() -> str: """ Generates a sentence that includes the words 'mango', 'colossal', and 'section' in a specific order. The sentence structure is: "A colossal mango section was found in the". Returns: ...
python_sharegpt_23k
16,564
Write a Python function that multiplies each element of a given list by a specified scalar if a boolean flag is set to `True`. If the boolean flag is `False`, the function should return the original list unchanged. The function should handle lists of integers and ensure that the scalar is an integer. The code should s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def multiply_list_by_scalar(lst: List[int], scalar: int, should_multiply: bool) -> List[int]: """ Multiplies each element of a given list by a specified scalar if a boolean flag is True. If the boole...
python_sharegpt_23k
16,565
Write a Python function to correct common typos in a given text using regular expressions. The function should identify and correct specific typos such as missing letters, transposed letters, and extra letters. The function should return the corrected text. The code should start with: ```python import re def correct_...
Here is the Python code to solve the given problem in the markdown block: ```python import re def correct_typos(text: str) -> str: """ Corrects common typos in the given text using regular expressions. Args: text (str): The input text containing typos. Returns: str: The corrected text...
python_sharegpt_23k
16,568
Write a Python function to filter out names from a given list that are palindromes (i.e., they read the same forward and backward). The function should not use Python's built-in palindrome function. The function should handle names with spaces and should be case-insensitive. 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 filter_palindrome_names(names: List[str]) -> List[str]: """ Filters out names from a given list that are palindromes (i.e., they read the same forward and backward). Args: names (List[st...
python_sharegpt_23k
16,571
Write a Python function to compute the total number of each product sold from a list of customer orders. Each order is represented as a tuple containing an order ID, a product name, and the quantity of the product sold. The function should return a dictionary where the keys are product names and the values are the tota...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def total_products_sold(orders: List[Tuple[int, str, int]]) -> Dict[str, int]: """ Computes the total number of each product sold from a list of customer orders. Args: orders (L...
python_sharegpt_23k
16,588
Write a Python function to retrieve the personal details of a specific person from a given dataset. The dataset is a dictionary where each key is a person's name and the value is another dictionary containing the person's age, gender, and hometown. The function should accept a name as input and return a dictionary with...
Here is the Python code to solve the given problem in the markdown block: ```python def get_person_info(name: str, data: dict) -> dict: """ Retrieve the personal details of a specific person from a given dataset. Args: name (str): The name of the person whose details are to be retrieved. da...
python_sharegpt_23k
16,592
Write a Python function to merge two dictionaries and combine their values for common keys using the addition operation. If a key exists in both dictionaries, the function should add their values together. If a key exists only in one dictionary, it should be included in the result with its original value. The function ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Any def merge_and_add_dicts(dict1: Dict[Any, int], dict2: Dict[Any, int]) -> Dict[Any, int]: """ Merges two dictionaries and combines their values for common keys using the addition operation. Args...
python_sharegpt_23k
16,594
Write a Python function to calculate the sales tax and deduct it from a given subtotal. The function should take the subtotal and the tax rate as inputs and return the total after deducting the sales tax. The code should start with: ```python def calculate_total_after_tax(subtotal: float, tax_rate: float) -> float: ```...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_total_after_tax(subtotal: float, tax_rate: float) -> float: """ Calculate the total after deducting the sales tax from the given subtotal. Args: subtotal (float): The initial amount before tax. ...
python_sharegpt_23k
16,595
Write a Python function that takes a string `input_str` as input and performs the following tasks: 1. Reverses the string. 2. Creates a table that displays the ASCII values of each character in the string and its binary equivalent. 3. Adds an error handling component that returns an error message if the input is not a ...
Here is the Python code to solve the given problem in the markdown block: ```python def reverse_hello(input_str: str) -> tuple: """ Reverses the input string 'hello' and creates a table displaying the ASCII values and binary equivalents of each character. Args: input_str (str): The input string to ...
python_sharegpt_23k
16,642
Write a Python function to find the minimum number of meeting rooms required to accommodate a given list of intervals representing start and end times of meetings. Each interval is a tuple where the first element is the start time and the second element is the end time. The list of intervals is sorted based on their st...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple import heapq def min_meeting_rooms(intervals: List[Tuple[int, int]]) -> int: """ Calculate the minimum number of meeting rooms required to accommodate all given intervals. Args: inter...
python_sharegpt_23k
16,650
Write a Python function to classify a list of abstract concepts as positive, negative, or neutral based on predefined keywords. The function should take a list of concepts as input and return a list of tuples, where each tuple contains a concept and its corresponding category. If a concept does not match any predefined...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def classify_concepts(concepts: List[str]) -> List[Tuple[str, str]]: """ Classify a list of abstract concepts as positive, negative, neutral, or unknown based on predefined keywords. Args: ...
python_sharegpt_23k
16,653
Write a Python function to calculate the average marks of a class given a list of marks. The function should handle cases where the list might be empty by returning `None` in such scenarios. The code should start with: ```python from typing import List, Optional def calculate_average_marks(marks: List[int]) -> Optiona...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def calculate_average_marks(marks: List[int]) -> Optional[float]: """ Calculate the average marks of a class given a list of marks. Args: marks (List[int]): A list of integers repr...
python_sharegpt_23k
16,661
Write a Python function to create a vector of numbers where each number in the vector appears 'm' times until the value of 'n' is reached. The resulting vector should be generated using NumPy and sorted in ascending order. The function should start with: ```python import numpy as np def create_sorted_vector(n: int, m:...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np def create_sorted_vector(n: int, m: int) -> np.ndarray: """ Create a vector of numbers where each number appears 'm' times until the value of 'n' is reached. The resulting vector is sorted in ascending or...
python_sharegpt_23k
16,664
Write a Python function to find the two longest strings from a given list of strings that meet the following criteria: 1. Each string must contain at least one capital letter. 2. Each string must contain at least one punctuation mark. The function should return the two longest strings that satisfy these conditions. If...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import string def find_longest_valid_strings(strings: List[str]) -> List[str]: """ Finds the two longest strings from a given list that contain at least one capital letter and one punctuation mark. ...
python_sharegpt_23k
16,668
Write a Python function to perform matrix subtraction of two vectors `x` and `y`, producing a new vector `result`. Each element in the `result` vector should be the difference between the corresponding elements of `x` and `y`. The function should handle vectors of different lengths by taking the minimum length of the t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def vector_subtraction(x: List[int], y: List[int]) -> List[int]: """ Perform vector subtraction of two vectors x and y, producing a new vector result. Args: x (List[int]): The first vector. ...
python_sharegpt_23k
16,672
Write a Python function to calculate the number of times a piece of paper, initially 0.1 millimeters thick, needs to be folded to reach a specified thickness in meters. The function should take the target thickness as an argument and return the number of folds required. The code should start with: ```python def calcul...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_folds_to_reach_thickness(target_thickness: float) -> int: """ Calculate the number of times a piece of paper, initially 0.1 millimeters thick, needs to be folded to reach a specified thickness in meters. A...
python_sharegpt_23k
16,674
Write a Python function to categorize ingredients into multiple categories, handling scenarios where an ingredient can belong to more than one category. Each ingredient should store a name and a quantity, and each category should store a name and a list of ingredients. The function should take in a list of ingredients ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def categorize_ingredients(ingredients: List[Dict[str, str]], categories: List[Dict[str, List[str]]]) -> Dict[str, Dict[str, int]]: """ Categorizes ingredients into multiple categories, handling sc...
python_sharegpt_23k
16,682
Write a Python function to convert a given string into an array of ASCII codes and display the resulting array in a table format. The function should also handle a string consisting of multiple words, converting each word separately and displaying their ASCII codes in separate tables. The code should start with: ```py...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def convert_string_to_ascii(string: str) -> List[List[int]]: """ Converts a given string into an array of ASCII codes and displays the resulting array in a table format. Handles a string consisting o...
python_sharegpt_23k
16,686
Write a Python function to retrieve the personal details of a specific person from a given dataset. The dataset is represented as a dictionary where each key is a person's name and the value is another dictionary containing their personal details (age, gender, occupation, and hometown). The function should accept a per...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def get_person_info(name: str, data: Dict[str, Dict[str, str]]) -> Dict[str, str]: """ Retrieves the personal details of a specific person from a given dataset. Args: name (str): The name of...
python_sharegpt_23k
16,691
Write a Python function to generate a string that emphasizes a given word or phrase using the "epizeuxis" rhetorical device, which involves repeating the word or phrase in quick succession. The function should allow customization of the number of repetitions and the punctuation used for emphasis. The code should start...
Here is the Python code to solve the given problem in the markdown block: ```python def emphasize_with_epizeuxis(phrase: str, repetitions: int = 3, punctuation: str = "!") -> str: """ Generates a string that emphasizes a given word or phrase using the "epizeuxis" rhetorical device. Args: phrase (st...
python_sharegpt_23k
16,695
Write a Python function to extract the device name from a given text string. The device name is identified by a substring that starts with "Name: " and ends with any characters. If the device name is not found, the function should return a default value of "Unknown". 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 Optional import re def extract_device_name(text: str, default: Optional[str] = "Unknown") -> str: """ Extracts the device name from a given text string. The device name is identified by a substring that s...
python_sharegpt_23k
16,696
Write a Python function to filter out even numbers from a given list and compute their sum. The function should return a tuple containing the filtered list of even numbers and their sum. The code should start with: ```python from typing import List, Tuple def filter_even_numbers_and_sum(data: List[int]) -> Tuple[List[...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def filter_even_numbers_and_sum(data: List[int]) -> Tuple[List[int], int]: """ Filters out even numbers from the given list and computes their sum. Args: data (List[int]): The list of...
python_sharegpt_23k
16,698
Write a Python function to enhance a given sentence by adding descriptive adjectives and setting it in the past tense. The function should randomly select adjectives for the feline and the table from predefined lists and modify the sentence accordingly. The original sentence is: "The feline [hopped] onto the [table]." ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def enhance_sentence(feline_adjectives: List[str], table_adjectives: List[str]) -> str: """ Enhances a given sentence by adding descriptive adjectives and setting it in the past tense. ...
python_sharegpt_23k
16,702
Write a Python function to simulate the temperature maintenance of a cold beverage in an eco-friendly tumbler over a given time period. The function should take the initial temperature of the beverage, the time period in hours, and the heat transfer rate (which represents the insulation efficiency) as inputs. The funct...
Here is the Python code to solve the given problem in the markdown block: ```python def maintain_temperature(initial_temperature: float, time: float, heat_transfer_rate: float) -> float: """ Simulate the temperature maintenance of a cold beverage in an eco-friendly tumbler over a given time period. Args: ...
python_sharegpt_23k
16,703
Write a Python function to calculate the exact date that is a specified number of days after the current date. The function should take an integer `days` as input and return the future date as a `datetime.date` object. The code should start with: ```python import datetime def calculate_future_date(days: int) -> dateti...
Here is the Python code to solve the given problem in the markdown block: ```python import datetime def calculate_future_date(days: int) -> datetime.date: """ Calculate the exact date that is a specified number of days after the current date. Args: days (int): The number of days to add to the curr...
python_sharegpt_23k
16,712
Write a Python function to calculate and display the sum and difference of two given numbers. The function should return a tuple containing the sum and difference. The code should start with: ```python def calculate_sum_and_difference(num1: int, num2: int) -> tuple: ```
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_sum_and_difference(num1: int, num2: int) -> tuple: """ Calculate the sum and difference of two given numbers. Args: num1 (int): The first number. num2 (int): The second number. Returns: ...
python_sharegpt_23k
16,716
Write a Python function to create a dynamic onboarding process for an employee based on their department and job role. The function should be able to handle a more complex onboarding process with multiple steps and customizable steps for different departments. Additionally, the function should dynamically add onboardin...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Any def create_onboarding_process(employee_name: str, department: str, job_role: str) -> List[Dict[str, Any]]: """ Create a dynamic onboarding process for an employee based on their department and...
python_sharegpt_23k
16,717
Write a Python function to encrypt a given string using the ROT13 cipher and ensure that the output only contains uppercase letters. The ROT13 cipher is a substitution cipher that replaces each letter with the letter 13 places down the alphabet. Non-alphabetic characters should remain unchanged. The code should start ...
Here is the Python code to solve the given problem in the markdown block: ```python def rot13_uppercase(input_string: str) -> str: """ Encrypts a given string using the ROT13 cipher and ensures the output is in uppercase. Args: input_string (str): The string to be encrypted. Returns: s...
python_sharegpt_23k
16,718
Write a Python function to remove specific words from a dataset of course reviews. The function should handle variations in grammar and word order within the sentences and should also handle cases where the targeted word is part of a larger word. The function should use regular expressions to ensure that the words are ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def remove_targeted_words(dataset: List[str], words_to_remove: List[str]) -> List[str]: """ Removes specific words from a dataset of course reviews. Args: dataset (List[str]): A li...
python_sharegpt_23k
16,720
Write a Python function to generate a list of random user records for testing purposes. Each record should include a unique ID, full name, email, phone number, address, city, state, ZIP code, and country. The function should accept an integer `num_records` as input, which specifies the number of records to generate. Th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict import random def generate_test_data(num_records: int) -> List[Dict[str, str]]: """ Generates a list of random user records for testing purposes. Args: num_records (int): The number of...
python_sharegpt_23k
16,724
Write a Python function to verify whether all circles in a given set of objects are blue. The set is represented as a list `Z=[z_1,...,z_n]`, where each `z_i` is a pair of integers, i.e., each `z_i=(a_i, b_i)` where `a_i` and `b_i` are integers. These two integers represent the properties of `z_i`, with `a_i` represent...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def verify_circles_are_blue(Z: List[Tuple[int, int]]) -> bool: """ Verify whether all circles in the given set of objects are blue. Args: Z (List[Tuple[int, int]]): A list of tuples w...
python_sharegpt_23k
16,725
Write a Python function to determine if a given number is a prime number. The function should return `True` if the number is prime and `False` otherwise. The function should handle edge cases such as numbers less than 2, which are not prime by definition. The code should start with: ```python def is_prime(n: int) -> b...
Here is the Python code to solve the given problem in the markdown block: ```python def is_prime(n: int) -> bool: """ Determine if a given number is a prime number. Args: n (int): The number to check for primality. Returns: bool: True if the number is prime, False otherwise. """ ...
python_sharegpt_23k
16,729
Write a Python function to generate a random zodiac sign belonging to the fire element. The function should return the name of the randomly selected zodiac sign. The code should start with: ```python from typing import List import random def get_random_fire_sign() -> str: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List import random def get_random_fire_sign() -> str: """ Generates a random zodiac sign belonging to the fire element. Returns: str: The name of the randomly selected fire element zodiac sign....
python_sharegpt_23k
16,733
Write a Python function to calculate the average of a list of numbers, handling the scenario where the list is empty by returning `None`. The function should start with: ```python from typing import List, Optional def calculate_average(numbers: List[int]) -> Optional[float]: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def calculate_average(numbers: List[int]) -> Optional[float]: """ Calculate the average of a list of numbers. If the list is empty, return None. Args: numbers (List[int]): The list...
python_sharegpt_23k
16,751
Write a Python function to determine whether each number in a given list of integers is prime or composite. The function should return a list of tuples, where each tuple contains a number and a string indicating whether the number is "Prime" or "Composite". The code should start with: ```python from typing import List...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple import math def is_prime(num: int) -> bool: """ Check if a number is prime. Args: num (int): The number to check. Returns: bool: True if the number is prime, False otherw...
python_sharegpt_23k
16,762
Write a Python function that takes a list of dictionaries as input and returns a new list of dictionaries containing only the keys that appear in all dictionaries of the input list. If there are no common keys among the dictionaries, the function should return an empty list. The function should handle cases where the i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def common_keys_in_dicts(dicts: List[Dict[str, any]]) -> List[Dict[str, any]]: """ Returns a new list of dictionaries containing only the keys that appear in all dictionaries of the input list. ...
python_sharegpt_23k
16,772
Write a Python function to find the second highest number in a given array of integers. The function should handle arrays with duplicate values and arrays with fewer than two elements. The code should start with: ```python from typing import List def find_second_highest(arr: 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_highest(arr: List[int]) -> int: """ Find the second highest number in a given array of integers. Args: arr (List[int]): The array of integers from which to find the second ...
python_sharegpt_23k
16,775
Write a Python function to reverse a given list of integers. The function should return a new list that is the reverse of the input list, without modifying the original list. The code should start with: ```python from typing import List def reverse_list(input_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 reverse_list(input_list: List[int]) -> List[int]: """ Returns a new list that is the reverse of the input list without modifying the original list. Args: input_list (List[int]): The li...
python_sharegpt_23k
16,783
Write a Python function to validate a list of email addresses using regular expressions. The function should return a list of boolean values indicating whether each email in the input list is valid or not. The code should start with: ```python from typing import List import re def validate_emails(emails: List[str]) ->...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def validate_emails(emails: List[str]) -> List[bool]: """ Validates a list of email addresses using a regular expression pattern. Args: emails (List[str]): A list of email addresse...
python_sharegpt_23k
16,789
Write a Python function to remove all duplicate strings from an input array of strings, ensuring each element within the array is unique and not repeated. The function should maintain the order of the first occurrence of each string. The code should start with: ```python from typing import List def remove_duplicates(...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_duplicates(arr: List[str]) -> List[str]: """ Removes all duplicate strings from the input array, ensuring each element is unique and maintaining the order of their first occurrence. Args:...
python_sharegpt_23k
16,794
Write a Python function that takes two integers as input and returns their sum. Additionally, the function should print the sum using the `print` statement. The function should be named `sum_two_numbers` and should start with: ```python def sum_two_numbers(num1: int, num2: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def sum_two_numbers(num1: int, num2: int) -> int: """ Calculate the sum of two integers and print the result. Args: num1 (int): The first integer. num2 (int): The second integer. Returns: int: T...
python_sharegpt_23k
16,796
Write a Python function to initialize two integer variables `a` and `b` such that their sum is an odd number. Then, compute the product of these two variables, find the square root of the product, and round it to the nearest integer. Return the resulting value. The code should start with: ```python import math def co...
Here is the Python code to solve the given problem in the markdown block: ```python import math def compute_final_value(a: int, b: int) -> int: """ Initialize two integer variables such that their sum is an odd number, compute their product, find the square root of the product, and round it to the nearest ...
python_sharegpt_23k
16,812
Write a Python function to find the three least common values in a given list that are within the range [7, 12]. The function should also return the frequency of occurrence for each of these values in the list. The results should be displayed in a table format with the values listed in ascending order and their frequen...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def find_least_common_values(lst: List[int]) -> List[Tuple[int, int]]: """ Find the three least common values in the given list that are within the range [7, 12]. Return the values and their f...
python_sharegpt_23k
16,816
Write a Python function to sort a list of ice cream flavors by their prices in ascending order, while excluding flavors that contain certain dietary restrictions. The input list should contain tuples where each tuple consists of a string representing the ice cream flavor, a float representing its price, and a list of s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def sort_ice_cream_flavors(ice_creams: List[Tuple[str, float, List[str]]], exclude_dietary: List[str]) -> List[Tuple[str, float, List[str]]]: """ Sorts a list of ice cream flavors by their prices ...
python_sharegpt_23k
16,819
Write a Python function to reverse an array of integers that includes both positive and negative integers. The function should take a list of integers as input and return the reversed list. The code should start with: ```python from typing import List def reverse_array(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 reverse_array(arr: List[int]) -> List[int]: """ Reverses an array of integers in-place. Args: arr (List[int]): The array of integers to be reversed. Returns: List[int]: The ...
python_sharegpt_23k
16,822
Write a Python function to generate a list of 15 unique outdoor activities with no overlap in terms of activity name, location, and intensity level. Each activity should offer an exclusive experience and differ in terms of the level of intensity, geographical location, and type. The function should return the list in a...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict import random def generate_unique_outdoor_activities() -> List[Dict[str, str]]: """ Generates a list of 15 unique outdoor activities with no overlap in terms of activity name, location, and intensi...
python_sharegpt_23k
16,825
Write a Python function to calculate the sum of two units and compare it with the theoretical value of two. The function should also compute the error between the computed sum and the theoretical value. Additionally, create a table that consists of twenty or more values of the variables `a` and `b`, and compute the err...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def calculate_sum_and_error(a: float, b: float) -> Tuple[float, float]: """ Calculate the sum of two units and the error between the computed sum and the theoretical value of 2. Args: ...
python_sharegpt_23k
16,827
Write a Python function to extract unique elements from a given list while preserving their original order. The function should handle lists of integers and return a list of unique integers in the order they first appear in the input list. The code should start with: ```python from typing import List def extract_uniq...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def extract_unique_elements(input_list: List[int]) -> List[int]: """ Extracts unique elements from a given list while preserving their original order. Args: input_list (List[int]): The list ...
python_sharegpt_23k
16,831
Write a Python function to calculate the sum of all even numbers less than or equal to a given integer `n`. The function should iterate through all numbers from 1 to `n` and use a conditional statement to check if a number is even before adding it to the sum. The code should start with: ```python def sum_even_numbers(n...
Here is the Python code to solve the given problem in the markdown block: ```python def sum_even_numbers(n: int) -> int: """ Calculates the sum of all even numbers less than or equal to n. Args: n (int): The upper limit for the even numbers to be summed. Returns: int: The sum of all ev...
python_sharegpt_23k
16,834
Write a Python function to generate a random numerical sequence of eight digits where each digit follows a Gaussian distribution with a specified mean and standard deviation. The function should ensure that each digit in the sequence is an integer between 0 and 9. 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 Tuple import numpy as np def generate_gaussian_sequence(mean: float, std_dev: float) -> str: """ Generates a random numerical sequence of eight digits where each digit follows a Gaussian distribution. Ar...
python_sharegpt_23k
16,843
Write a Python function that applies a given mathematical formula to each element in a list of integers using the `map()` function. The mathematical formula should be defined as a separate function. The function should return the transformed list. The code should start with: ```python from typing import List def appl...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def complex_formula(num: int) -> int: """ A complex mathematical formula applied to each element in the list. Args: num (int): The integer to which the formula is applied. Returns: ...
python_sharegpt_23k
16,845
Write a Python function to find the first prime number greater than a given threshold from a list of numbers. The function should return the prime number if found, otherwise return `None`. The code should start with: ```python from typing import List, Optional def find_first_prime_greater_than(numbers: List[int], thr...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def is_prime(num: int) -> bool: """ Check if a given number is prime. Args: num (int): The number to check for primality. Returns: bool: True if the number is prime, F...
python_sharegpt_23k
16,851
Write a Python function to generate a right triangle using the `'*'` character. The right triangle should have a right angle at the bottom left corner and be of side length `N`. Additionally, the function should handle invalid inputs (non-positive integers) by returning an appropriate error message. The code should st...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_right_triangle(n: int) -> str: """ Generates a right triangle using the '*' character of side length n. Args: n (int): The side length of the right triangle. Must be a positive integer. Returns: ...
python_sharegpt_23k
16,860
Write a Python function to calculate the Least Common Multiple (LCM) of numbers from 1 to n, considering the prime factors of each number and ensuring that the LCM only contains prime factors less than or equal to n. The function should be efficient and leverage number theory concepts. The code should start with: ```p...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_lcm_up_to_n(n: int) -> int: """ Calculate the Least Common Multiple (LCM) of numbers from 1 to n. Args: n (int): The upper limit of the range of numbers. Returns: int: The LCM of numbers f...
python_sharegpt_23k
16,887
Write a Python function to add a suffix to a given word and return the new word. The function should handle cases where the suffix is an empty string or the word is an empty string. The code should start with: ```python def add_suffix_to_word(word: str, suffix: str) -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python def add_suffix_to_word(word: str, suffix: str) -> str: """ Adds a suffix to a given word and returns the new word. Args: word (str): The base word to which the suffix will be added. suffix (str): The suffix ...
python_sharegpt_23k
16,890
Write a Python function to insert a specific element between two elements in a list, where the first element is less than a given value and the second element is greater than the given value, without increasing the list's size before adding. The function should update the indices of the following elements accordingly. ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def insert_between_elements(my_list: List[int], value: float) -> List[int]: """ Inserts a specific element between two elements in a list, where the first element is less than a given value and the s...
python_sharegpt_23k
16,893
Write a Python function to extract all instances of the term "machine learning engineer" from the job titles on an Indeed page for "Data Scientist". The function should parse the HTML content of the page and return a list of job titles that match the term "machine learning engineer". The code should start with: ```pyt...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List from bs4 import BeautifulSoup import re def extract_machine_learning_engineer_jobs(html_content: str) -> List[str]: """ Extracts all instances of the term "machine learning engineer" from job titles on a...
python_sharegpt_23k
16,915
Write a Python function to extract rows from a given NumPy matrix that contain prices denoted by a dollar sign. The matrix consists of item IDs and their corresponding prices, where some prices are represented with a dollar sign while others are not. The function should return a new NumPy array containing only the rows...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np import re from typing import List def extract_dollar_price_rows(matrix: np.ndarray) -> np.ndarray: """ Extracts rows from a given NumPy matrix that contain prices denoted by a dollar sign. Args: ...
python_sharegpt_23k
16,916
Write a Python function to calculate the average weight of each animal type from a given table. The table is represented as a list of lists, where each inner list contains the weights of different types of animals in the order: cats, dogs, rabbits, hamsters, and birds. The function should return a list of average weigh...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculate_average_weights(table: List[List[float]]) -> List[float]: """ Calculate the average weight of each animal type from a given table. Args: table (List[List[float]]): A list of li...
python_sharegpt_23k
16,920
Write a Python function to find the alphabetically first string from a given list of strings using the selection sort algorithm. The function should return the string that comes first in alphabetical order. The code should start with: ```python from typing import List def find_alphabetically_first_string(strings: Lis...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_alphabetically_first_string(strings: List[str]) -> str: """ Finds the alphabetically first string from a given list of strings using the selection sort algorithm. Args: strings (Lis...
python_sharegpt_23k
16,947
Write a Python function to filter out even numbers from a given list of integers. The function should return a new list containing only the even numbers from the input list. If the input list does not contain any even numbers, the function should return an empty list. 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 filter_even_numbers(lst: List[int]) -> List[int]: """ Filters out even numbers from a given list of integers and returns a new list containing only the even numbers. If the input list does not co...
python_sharegpt_23k
16,950
Write a Python function to determine the optimal placement of wind turbines based on multiple criteria including wind speed, direction, temperature, humidity, terrain, and surrounding environment. The function should return a boolean indicating whether the wind turbine can be placed at the given location or not. The co...
Here is the Python code to solve the given problem in the markdown block: ```python def can_place_wind_turbine(wind_speed: float, wind_direction: int, temperature: float, humidity: int, terrain: str, environment: str) -> bool: """ Determines if a wind turbine can be placed at a given location based on multiple ...
python_sharegpt_23k
16,962
Write a Python function to calculate the sum of a list of numbers with added error handling. The function should raise appropriate exceptions if the input is not a list, if the list contains non-numeric values, if the list is empty, or if the list length exceeds 10^6. The function should start with: ```python def calcu...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_sum(lst): """ Calculate the sum of a list of numbers with added error handling. Args: lst (list): The list of numbers to sum. Returns: float or int: The sum of the list of numbers. Ra...
python_sharegpt_23k
16,973
Write a Python function to calculate the sum of the fourth powers of the first n natural numbers, starting from a given point. The function should use a for loop and accept two arguments: the number of natural numbers 'n' and the starting point of the sequence (default is 1). The function should return an error message...
Here is the Python code to solve the given problem in the markdown block: ```python def sum_of_fourth_powers(n: int, start: int = 1) -> int: """ Calculate the sum of the fourth powers of the first n natural numbers, starting from a given point. Args: n (int): The number of natural numbers to consid...
python_sharegpt_23k
16,984
Write a Python function that takes a list of dictionaries and a key-value pair as input, and returns a new list of dictionaries that contain the specified key-value pair. The function should use dictionary comprehension to achieve this. The code should start with: ```python from typing import List, Dict def get_dicti...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def get_dictionaries_with_key_value_pair(dict_list: List[Dict[str, any]], key: str, value: any) -> List[Dict[str, any]]: """ Returns a new list of dictionaries that contain the specified key-value ...
python_sharegpt_23k
16,993
Write a Python function to generate an anagram of at least four letters from a given word that includes at least one vowel and one consonant. The function should return a list of all such anagrams. The code should start with: ```python from typing import List import itertools def generate_anagrams(word: str) -> List[...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import itertools def generate_anagrams(word: str) -> List[str]: """ Generate anagrams of at least four letters from a given word that include at least one vowel and one consonant. Args: word...
python_sharegpt_23k
16,995
Write a Python function to sort a list of integers in descending order and remove any duplicates. The function should take a list of integers as input and return a sorted list of unique integers in descending order. The code should start with: ```python from typing import List def sort_and_remove_duplicates(lst: List[...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sort_and_remove_duplicates(lst: List[int]) -> List[int]: """ Sorts a list of integers in descending order and removes any duplicates. Args: lst (List[int]): The list of integers to be pr...