source stringclasses 6
values | id int64 0 111k | instruction stringlengths 167 4.39k | response stringlengths 244 6.1k |
|---|---|---|---|
python_sharegpt_23k | 22,222 | Write a Python function to generate the next number in a given sequence based on a mathematical pattern. The sequence provided is: 2, 6, 14, 30, 62. The function should identify the pattern and compute the next number in the sequence.
The code should start with:
```python
def next_number_in_sequence(previous_number: i... | Here is the Python code to solve the given problem in the markdown block:
```python
def next_number_in_sequence(previous_number: int) -> int:
"""
Calculate the next number in the sequence based on the given pattern.
The sequence follows the pattern where each number is obtained by multiplying the previous ... |
python_sharegpt_23k | 22,223 | Write a Python function to find the highest and lowest values for each attribute in a given dataset. The dataset is represented as a 2D NumPy array where each row corresponds to a record and each column corresponds to an attribute. The function should return two lists: one containing the highest values for each attribu... | Here is the Python code to solve the given problem in the markdown block:
```python
import numpy as np
from typing import List, Tuple
def find_extremes(dataset: np.ndarray) -> Tuple[List[float], List[float]]:
"""
Find the highest and lowest values for each attribute in a given dataset.
Args:
datas... |
python_sharegpt_23k | 22,224 | Write a Python function to extract all email addresses from a given text string. The function should use regular expressions to identify and return a list of all valid email addresses found in the text.
The code should start with:
```python
from typing import List
import re
def extract_emails(text: str) -> List[str]:... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import re
def extract_emails(text: str) -> List[str]:
"""
Extracts all valid email addresses from a given text string.
Args:
text (str): The text string from which to extract email addresses... |
python_sharegpt_23k | 22,233 | Write a Python function to sort a given list of words in ascending order based on their ASCII values and return both the sorted list and the reverse sorted list. The function should handle any list of words, not just the provided example.
The code should start with:
```python
from typing import List, Tuple
def sort_w... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Tuple
def sort_words_by_ascii(words: List[str]) -> Tuple[List[str], List[str]]:
"""
Sorts a given list of words in ascending order based on their ASCII values and returns both the sorted list and the re... |
python_sharegpt_23k | 22,236 | Write a Python function to reverse a given string using only built-in Python functions. The function should return the reversed string. 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 using only built-in Python functions.
Args:
s (str): The string to be reversed.
Returns:
str: The reversed string.
"""
# Use sl... |
python_sharegpt_23k | 22,240 | Write a Python function to generate a tryptic joke about a popular movie, utilizing wordplay, puns, and references to popular culture. The function should take a movie title, a hero, a villain, a weapon, and a team as input and return a list of three jokes. Each joke should be structured in a way that incorporates the ... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Tuple
import random
def generate_tryptic_joke(movie: str, hero: str, villain: str, weapon: str, team: str) -> List[Tuple[str, str, str, str, str]]:
"""
Generates a tryptic joke about a popular movie, ut... |
python_sharegpt_23k | 22,241 | Write a Python function to convert a given weight between kilograms and pounds, and another function to convert the weight of an object on Earth to its weight on the moon. The functions should be able to handle both directions of conversion (kilograms to pounds and pounds to kilograms) and provide the weight on the moo... | Here is the Python code to solve the given problem in the markdown block:
```python
def convert_weight(weight: float, from_unit: str, to_unit: str) -> float:
"""
Converts a given weight between kilograms and pounds.
Args:
weight (float): The weight to be converted.
from_unit (str): The unit... |
python_sharegpt_23k | 22,242 | Write a Python function to generate a random code that consists of four characters: two uppercase letters followed by two numbers. The letters should represent the initials of a program name, the first number should represent the number of trees in an outdoor classroom, and the second number should represent the total ... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import Tuple
import random
import string
def generate_outdoor_classroom_code() -> str:
"""
Generates a random code consisting of four characters: two uppercase letters followed by two numbers.
The letters repres... |
python_sharegpt_23k | 22,243 | 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 | 22,249 | Write a Python function to generate the first `k` terms of a quadratic sequence represented by the polynomial equation `n^2 + n + 1`, starting from `n=0`. The function should return a list of these terms.
The code should start with:
```python
from typing import List
def generate_quadratic_sequence(k: int) -> List[int... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def generate_quadratic_sequence(k: int) -> List[int]:
"""
Generate the first k terms of a quadratic sequence represented by the polynomial equation n^2 + n + 1, starting from n=0.
Args:
k (i... |
python_sharegpt_23k | 22,251 | Write a Python function to correct common typos in a given text using regular expressions. The function should identify and correct common errors 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_t... | 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 potential typos.
Returns:
str: The corr... |
python_sharegpt_23k | 22,258 | Write a Python function to generate a greeting message with a randomly selected name from a predefined list of names, and append an exclamation mark to the end of the greeting string. The function should return the greeting string.
The code should start with:
```python
from typing import List
import random
def genera... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import random
def generate_greeting(names: List[str]) -> str:
"""
Generates a greeting message with a randomly selected name from a list of names,
and appends an exclamation mark to the end of the gr... |
python_sharegpt_23k | 22,259 | Write a Python function that applies a given mathematical formula to each element of 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 apply_formula_to_list(nums: List[int], formula) -> List[int]:
"""
Applies a given mathematical formula to each element of a list of integers using the map() function.
Args:
nums (List[in... |
python_sharegpt_23k | 22,262 | Write a Python function to calculate the sum of the squares of a list of numbers. The function should be efficient and capable of handling lists of varying lengths, complexities, and data types. Additionally, consider the potential impacts of utilizing different programming languages, libraries, and frameworks on the o... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def sum_of_squares(lst: List[int]) -> int:
"""
Calculate the sum of the squares of a list of integers.
Args:
lst (List[int]): A list of integers for which the sum of squares is to be calcula... |
python_sharegpt_23k | 22,264 | Write a Python function to extract the unique elements from a given list of integers. The function should return a list containing only the unique elements in the order they first appear in the input list.
The code should start with:
```python
from typing import List
def extract_unique_elements(input_list: List[int])... | 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 the unique elements from a given list of integers, maintaining the order of their first appearance.
Args:
input_... |
python_sharegpt_23k | 22,267 | Write a Python function to generate a random sequence of 10 characters according to the following rules:
1. The first character is always an uppercase letter.
2. The next three characters are digits between 0 and 9.
3. The next four characters are lowercase letters.
4. The last two characters are either the special cha... | Here is the Python code to solve the given problem in the markdown block:
```python
import random
import string
def generate_random_sequence() -> str:
"""
Generates a random sequence of 10 characters according to the following rules:
1. The first character is always an uppercase letter.
2. The next thr... |
python_sharegpt_23k | 22,268 | Write a Python function to convert a traditional Italian tiramisu recipe into a vegan version by modifying the ingredient list. The function should replace non-vegan ingredients with their vegan alternatives while maintaining the classic taste of the dish. 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
def convert_to_vegan_tiramisu(ingredients: List[str]) -> List[str]:
"""
Converts a traditional Italian tiramisu recipe into a vegan version by replacing non-vegan ingredients with vegan alternatives.
... |
python_sharegpt_23k | 22,272 | Write a Python function to find the longest river in Africa from a given dataset of rivers and their lengths. The dataset is a dictionary where the keys are river names and the values are their lengths in kilometers. The function should return the name of the longest river.
The code 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 find_longest_river(rivers: Dict[str, int]) -> str:
"""
Finds the longest river in Africa from a given dataset of rivers and their lengths.
Args:
rivers (Dict[str, int]): A dictionary whe... |
python_sharegpt_23k | 22,273 | 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 | 22,275 | Write a Python function to find the missing word in a sentence using a list of sunrise times. The function should take a list of sunrise times in string format and a target date in string format, and return the missing word in the sentence "The sun rose _____ the horizon on [target date]." The missing word should be th... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import datetime
def find_missing_word(sunrise_times: List[str], target_date: str) -> str:
"""
Finds the missing word in the sentence "The sun rose _____ the horizon on [target date]."
using a list of... |
python_sharegpt_23k | 22,277 | 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 | 22,279 | Write a Python function to generate a limerick using a randomly selected word from a list of words that rhyme with "orange". The function should return the limerick as a string. The limerick template should be flexible enough to accommodate any word from the list.
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
import random
def generate_limerick(rhyming_words: List[str]) -> str:
"""
Generates a limerick using a randomly selected word from a list of words that rhyme with "orange".
Args:
rhyming_wor... |
python_sharegpt_23k | 22,280 | Write a Python function to determine whether a given number is even or odd. The function should return a string indicating "Even" or "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 | 22,285 | Write a Python function to describe a place that holds special significance to you. The function should include the name of the place, its location, a brief description, sensory experiences that made it memorable, and any historical or cultural significance of the location. The function should return a formatted string... | Here is the Python code to solve the given problem in the markdown block:
```python
def describe_special_place() -> str:
"""
Describes a place that holds special significance, including its name, location, description, sensory experiences, and historical or cultural significance.
Returns:
str: A fo... |
python_sharegpt_23k | 22,294 | Write a Python function to find the closest Kelvin temperature to a given target Kelvin temperature from a provided dictionary of Kelvin to Fahrenheit conversion rates. The function should return the equivalent Fahrenheit temperature, rounded to the nearest hundredth. 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 Dict
def find_closest_temperature(kelvin_fahrenheit: Dict[int, float], target_kelvin: int) -> float:
"""
Finds the closest Kelvin temperature to a given target Kelvin temperature and returns its equivalent Fa... |
python_sharegpt_23k | 22,295 | Write a Python function to reverse the words in a given string while maintaining the order of the words. For example, if the input string is "Hello world this is a test", the output should be "test a is this world Hello". The function should handle strings with multiple spaces between words and leading/trailing spaces.... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words_in_string(s: str) -> str:
"""
Reverses the words in a given string while maintaining the order of the words.
Args:
s (str): The input string containing words to be reversed.
Returns:
s... |
python_sharegpt_23k | 22,296 | Write a Python function to randomly generate a list of five rare items, one from each category, for a virtual reality game. The categories and their corresponding items are predefined. The function should ensure that each item is unique and belongs to a different category. The code should start with:
```python
from typ... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import random
def generate_rare_items() -> List[str]:
"""
Generates a list of five rare items, one from each category, for a virtual reality game.
Returns:
List[str]: A list containing five ... |
python_sharegpt_23k | 22,304 | 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_and_print`.
The code should start with:
```python
def sum_and_print(num1: int, num2: int) -> int:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def sum_and_print(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: The... |
python_sharegpt_23k | 22,307 | Write a Python function to sort a list of objects by their color (in the order: red, green, blue) and then by their size (from small to large). Each object is represented as a dictionary with keys: `name`, `color`, `size`, and `rgb`. The function should return the sorted list of objects. Additionally, the function shou... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Dict
def sort_objects_by_color_and_size(objects: List[Dict[str, any]]) -> List[Dict[str, any]]:
"""
Sorts a list of objects by their color (in the order: red, green, blue) and then by their size (from s... |
python_sharegpt_23k | 22,308 | Write a Python function that takes two arguments: an integer `x` and a list of integers `y`, and returns a list of integers that are the result of multiplying `x` with each element in `y`. Additionally, write a function to calculate the sum of the resulting list. 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
def multiply_elements(x: int, y: List[int]) -> List[int]:
"""
Multiplies each element in the list `y` by the integer `x`.
Args:
x (int): The integer to multiply each element in the list by.
... |
python_sharegpt_23k | 22,311 | Write a Python function to calculate the sum of the squares of all the odd numbers between 1 and a given positive integer `n`, inclusive. The function should return a list of tuples, where each tuple contains an odd number, its square, and the running sum of the squares up to that number. The function should also ensur... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Tuple
def sum_of_squares_of_odds(n: int) -> List[Tuple[int, int, int]]:
"""
Calculate the sum of the squares of all the odd numbers between 1 and n, inclusive.
Args:
n (int): The upper limi... |
python_sharegpt_23k | 22,324 | Write a Python function to generate a list of different modes of transportation that can be used to travel from one city to another. The function should accept two parameters: the starting city and the destination city. The function should return a list of modes of transportation, including "Plane", "Train", "Bus", and... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def get_modes_of_transportation(start_city: str, destination_city: str) -> List[str]:
"""
Generate a list of different modes of transportation that can be used to travel from the start city to the destin... |
python_sharegpt_23k | 22,336 | Write a Python function to shift all the letters in a given string two characters ahead in the alphabet. For example, if the input string is "apple", the output should be "crrng". The function should handle both uppercase and lowercase letters and wrap around the alphabet if necessary (e.g., 'z' should become 'b' and '... | Here is the Python code to solve the given problem in the markdown block:
```python
def shift_letters_by_two(word: str) -> str:
"""
Shifts all the letters in the given string two characters ahead in the alphabet.
Non-alphabet characters remain unchanged.
Args:
word (str): The input string to be... |
python_sharegpt_23k | 22,340 | Write a Python function that generates a LaTeX formula representing the sentence "She who enjoys jogging on the seashore" using a given subject. The function should also incorporate a table of synonyms for "run" and "beach" that it can utilize. The function should start with:
```python
from typing import Dict
def gene... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import Dict
import random
def generate_latex_formula(subject: str, synonyms: Dict[str, list]) -> str:
"""
Generates a LaTeX formula representing the sentence "She who enjoys jogging on the seashore" using a given su... |
python_sharegpt_23k | 22,347 | Write a Python function to invert the order of words in a given sentence. The function should take a string as input and return a new string with the words in reverse order. The code should start with:
```python
def invert_sentence_order(sentence: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def invert_sentence_order(sentence: str) -> str:
"""
Inverts the order of words in a given sentence.
Args:
sentence (str): The input sentence whose words need to be reversed.
Returns:
str: A new sentenc... |
python_sharegpt_23k | 22,349 | Write a Python function to determine whether a given sentence is a pangram. A pangram is a sentence that contains every letter of the alphabet at least once. The function should take a string as input and return a boolean value indicating whether the string is a pangram or not. The function should be case-insensitive a... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_pangram(sentence: str) -> bool:
"""
Determines whether a given sentence is a pangram.
A pangram is a sentence that contains every letter of the alphabet at least once.
This function is case-insensitive and ignore... |
python_sharegpt_23k | 22,355 | Write a Python function to convert a fraction into its decimal equivalent. The function should take two positive integer inputs, the numerator and the denominator, and return the decimal equivalent as a float. The function should be able to handle any positive integer values for the numerator and denominator. The code ... | Here is the Python code to solve the given problem in the markdown block:
```python
def fraction_to_decimal(numerator: int, denominator: int) -> float:
"""
Convert a fraction into its decimal equivalent.
Args:
numerator (int): The numerator of the fraction. Must be a positive integer.
denom... |
python_sharegpt_23k | 22,358 | 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 | 22,364 | Write a Python function to extract all valid email addresses from a given text string. The function should use regular expressions to identify and return a list of all email addresses found in the text.
The code should start with:
```python
from typing import List
import re
def extract_emails(text: str) -> List[str]:... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import re
def extract_emails(text: str) -> List[str]:
"""
Extracts all valid email addresses from a given text string.
Args:
text (str): The text string from which to extract email addresses... |
python_sharegpt_23k | 22,365 | 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 | 22,373 | Write a Python function to generate a random color in RGB format and provide a clue based on the dominant color component (red, green, or blue) to help solve a riddle. The riddle is: "I am vast and constantly shifting, my magnificence is limitless, I display serene nature yet fierce intensity, and I am teeming with lif... | Here is the Python code to solve the given problem in the markdown block:
```python
import random
def generate_color_clue() -> tuple:
"""
Generates a random color in RGB format and provides a clue based on the dominant color component to help solve a riddle.
The riddle is: "I am vast and constantly shifti... |
python_sharegpt_23k | 22,374 | Write a Python function to arrange a list of words in alphabetical order and return the resulting sentence as a string. The function should handle lists of varying lengths and ensure that the words are sorted in a case-insensitive manner. The code should start with:
```python
from typing import List
def sort_sentence(... | Here is the Python code to solve the given problem in the markdown block:
:
```python
from typing import List
def sort_sentence(words: List[str]) -> str:
"""
Arrange a list of words in alphabetical order (case-insensitive) and return the resulting sentence as a string.
Args:
words (List[str]): A l... |
python_sharegpt_23k | 22,375 | Write a Python function to extract all numerical values from a given string while removing all HTML elements. The function should return a list of these numerical values. The code should start with:
```python
from typing import List
import re
def extract_numbers_from_string(input_string: str) -> List[str]:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import re
def extract_numbers_from_string(input_string: str) -> List[str]:
"""
Extracts all numerical values from a given string while removing all HTML elements.
Args:
input_string (str): T... |
python_sharegpt_23k | 22,379 | Write a Python function to extract all bigrams (consecutive pairs of words) from a given text. The function should return a list of tuples where each tuple contains a pair of consecutive words.
The code should start with:
```python
from typing import List, Tuple
def extract_bigrams(text: str) -> List[Tuple[str, str]]... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Tuple
def extract_bigrams(text: str) -> List[Tuple[str, str]]:
"""
Extracts all bigrams (consecutive pairs of words) from the given text.
Args:
text (str): The input text from which to extr... |
python_sharegpt_23k | 22,386 | Write a Python function to generate a random number between 1 and 100 that is not divisible by 5. The function should ensure that the generated number meets this criterion.
The code should start with:
```python
import random
def generate_random_number() -> int:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
import random
def generate_random_number() -> int:
"""
Generates a random number between 1 and 100 that is not divisible by 5.
Returns:
int: A random number between 1 and 100 that is not divisible by 5.
"""
... |
python_sharegpt_23k | 22,387 | Write a Python function to generate a personalized letter of recommendation for a candidate, incorporating their professional achievements, personal qualities, work ethic, and leadership abilities. The letter should be properly addressed to the intended recipient and include the recommender's contact information for fo... | Here is the Python code to solve the given problem in the markdown block:
```python
def generate_recommendation_letter(recipient: str, position: str, length_of_time: str, professional_achievements: str, personal_qualities: str, work_ethic_and_leadership_abilities: str, recommender_name: str, recommender_contact_info: s... |
python_sharegpt_23k | 22,389 | Write a Python function to generate a 30-minute high-intensity interval training (HIIT) workout plan that incorporates running and cycling. The workout should consist of 5 cycles, each with a duration of 6 minutes. In each cycle, the client should alternate between running and cycling for 30 seconds each, with a 30-sec... | Here is the Python code to solve the given problem in the markdown block:
```python
def generate_hiit_workout_plan():
"""
Generates a 30-minute high-intensity interval training (HIIT) workout plan.
The workout consists of 5 cycles, each lasting 6 minutes. In each cycle, the client
alternates between ru... |
python_sharegpt_23k | 22,391 | Write a Python function to filter out all odd numbers from a given list and then sort the remaining even numbers in descending order. The function should return the sorted list of even numbers.
The code should start with:
```python
from typing import List
def sort_evens_descending(arr: List[int]) -> List[int]:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def sort_evens_descending(arr: List[int]) -> List[int]:
"""
Filters out all odd numbers from the input list and sorts the remaining even numbers in descending order.
Args:
arr (List[int]): T... |
python_sharegpt_23k | 22,398 | Write a Python function to calculate the age of a person when they completed a specific work, given their birth year and the year they completed the work. The function should return the age as an integer.
The code should start with:
```python
def calculate_age_at_completion(birth_year: int, completion_year: int) -> in... | Here is the Python code to solve the given problem in the markdown block:
```python
def calculate_age_at_completion(birth_year: int, completion_year: int) -> int:
"""
Calculate the age of a person when they completed a specific work.
Args:
birth_year (int): The birth year of the person.
com... |
python_sharegpt_23k | 22,400 | 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 section'. The code should start with:
```python
def generate_senten... | 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 section."
R... |
python_sharegpt_23k | 22,403 | Write a Python function to convert a given string to camelCase. The input string will be in snake_case format, where words are separated by underscores. The function should return the string converted to camelCase, where the first word is in lowercase and each subsequent word starts with an uppercase letter.
The code ... | Here is the Python code to solve the given problem in the markdown block:
```python
def to_camel_case(snake_case_string: str) -> str:
"""
Converts a given snake_case string to camelCase.
Args:
snake_case_string (str): The input string in snake_case format.
Returns:
str: The converted s... |
python_sharegpt_23k | 22,407 | Write a Python function to identify the top 3 bodies of water with the most severe water pollution, taking into account the population living in the vicinity of the body of water. The dataset is a list of dictionaries, where each dictionary contains the following fields:
- "name": the name of the body of water
- "regio... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Dict
def top_3_polluted_bodies_of_water(data: List[Dict[str, any]]) -> List[str]:
"""
Identifies the top 3 bodies of water with the most severe water pollution,
taking into account the population li... |
python_sharegpt_23k | 22,420 | 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 | 22,421 | Write a Python function that generates a random idiom from a predefined list of idioms and returns both the idiom and its meaning. The function should handle a list of idioms and their meanings, and it should randomly select one idiom along with its meaning. 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 random
def get_random_idiom(idioms: List[Tuple[str, str]]) -> Tuple[str, str]:
"""
Randomly selects an idiom from a given list of idioms and returns both the idiom and its meaning.
Arg... |
python_sharegpt_23k | 22,435 | Write a Python function to convert a list of items into a sentence. The sentence should start with "I have ", followed by the items separated by commas, and the last item should be preceded by "and". The sentence should end with " in my basket."
The code should start with:
```python
from typing import List
def list_t... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def list_to_sentence(items: List[str]) -> str:
"""
Converts a list of items into a sentence.
The sentence starts with "I have ", followed by the items separated by commas,
and the last item prec... |
python_sharegpt_23k | 22,436 | Write a Python function to generate an HTML string that displays a sentence containing the words "blue", "apple", and "school". The word "apple" should be displayed in blue font color, while the words "blue" and "school" should be displayed in black. The function should return the complete HTML string.
The code should... | Here is the Python code to solve the given problem in the markdown block:
```python
def generate_html_sentence() -> str:
"""
Generates an HTML string that displays a sentence with specific text formatting.
The word "apple" is displayed in blue, while the words "blue" and "school" are displayed in black.
... |
python_sharegpt_23k | 22,440 | Write a Python function to calculate the sum of all integers in a given list. The function should handle lists of any size, including empty lists. The code should start with:
```python
from typing import List
def calculate_sum(numbers: List[int]) -> int:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def calculate_sum(numbers: List[int]) -> int:
"""
Calculate the sum of all integers in the given list.
Args:
numbers (List[int]): A list of integers.
Returns:
int: The sum of al... |
python_sharegpt_23k | 22,452 | Write a Python function to perform integer division and calculate the remainder of the division of two given integers. The function should return the quotient and the remainder as a tuple. Additionally, provide a detailed explanation of the concepts of floor division and integer division in Python, and compare their re... | Here is the Python code to solve the given problem in the markdown block:
```python
def integer_division_with_remainder(num1: int, num2: int) -> tuple:
"""
Perform integer division and calculate the remainder of the division of two integers.
Args:
num1 (int): The dividend.
num2 (int): The d... |
python_sharegpt_23k | 22,453 | 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 the girl overcoming challenges posed by the villain. The... | 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 the girl overcoming challenges posed by the villain.
"""
... |
python_sharegpt_23k | 22,457 | 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 new list with the integers sorted in descending order and duplicates removed. The code should start with:
```python
from typing import List
def sort_and_re... | 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... |
python_sharegpt_23k | 22,461 | Write a Python function to generate a random book title from a predefined list of notable authors who have made significant contributions to the realm of science fiction and fantasy literature, with their works set in a fictional universe lacking in technological or electrical advancements. The function should return a... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import Dict, List, Tuple
import random
def generate_random_book_title(authors: Dict[str, List[str]]) -> str:
"""
Generates a random book title from a predefined list of authors and their works.
Args:
au... |
python_sharegpt_23k | 22,468 | Write a Python function to calculate the total distance traveled by birds over a given number of days. The function should take a list of integers representing the distances traveled each day and return the total distance. The code should start with:
```python
from typing import List
def calculate_total_distance(dista... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def calculate_total_distance(distances: List[int]) -> int:
"""
Calculate the total distance traveled by birds over a given number of days.
Args:
distances (List[int]): A list of integers rep... |
python_sharegpt_23k | 22,470 | Write a Python function to convert a number from a given base to its decimal representation, and then to its equivalent binary and hexadecimal representations. The function should also display these conversions in a table format. Additionally, the function should handle potential errors or edge cases, such as invalid b... | Here is the Python code to solve the given problem in the markdown block:
```python
def convert_base_to_decimal_and_display(number: str, base: int) -> None:
"""
Converts a number from a given base to its decimal representation, and then to its equivalent binary and hexadecimal representations.
Displays the ... |
python_sharegpt_23k | 22,471 | Write a Python function to find the highest and lowest values for each attribute in a given dataset. The dataset is represented as a 2D NumPy array where each row represents a record and each column represents a numerical attribute. The function should return two lists: one for the highest values and one for the lowest... | Here is the Python code to solve the given problem in the markdown block:
```python
import numpy as np
from typing import List
def find_extremes(dataset: np.ndarray) -> (List[float], List[float]):
"""
Find the highest and lowest values for each attribute in a given dataset.
Args:
dataset (np.ndarr... |
python_sharegpt_23k | 22,473 | Write a Python function to categorize a given word as an adverb based on common suffixes used to identify adverbs. The function should check if the word ends with specific suffixes commonly associated with adverbs (e.g., "ly", "ily", "ward", "wards", "wise"). If the word matches any of these suffixes, it should be cate... | Here is the Python code to solve the given problem in the markdown block:
```python
def categorize_word(word: str) -> str:
"""
Categorizes a given word as an adverb based on common suffixes.
Args:
word (str): The word to be categorized.
Returns:
str: A string indicating whether the wor... |
python_sharegpt_23k | 22,478 | Write a Python function to generate a sorted list of unique integers in descending order from a given list of integers. The function should ensure that the resulting list contains only unique elements and is sorted in descending order.
The code should start with:
```python
from typing import List
def generate_sorted_... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def generate_sorted_unique_list(input_list: List[int]) -> List[int]:
"""
Generates a sorted list of unique integers in descending order from a given list of integers.
Args:
input_list (List[... |
python_sharegpt_23k | 22,481 | Write a Python function to classify a list of data points based on the given classification rule and return a dictionary containing the count of data points classified as "A" and "B". Each data point is a tuple consisting of two values: a numerical value `x` and a binary value `y`. The classification rule is as follows... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Tuple, Dict
def classify_data_points(data_points: List[Tuple[int, int]]) -> Dict[str, int]:
"""
Classify data points based on the given rule and return the count of each classification.
Args:
... |
python_sharegpt_23k | 22,485 | Write a Python function to check if a given string contains any substring that is a palindrome of length greater than or equal to 3. The function should return `True` if such a substring exists, otherwise `False`.
The code should start with:
```python
def contains_palindrome_substring(s: str) -> bool:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def contains_palindrome_substring(s: str) -> bool:
"""
Check if the given string contains any substring that is a palindrome of length greater than or equal to 3.
Args:
s (str): The input string to check for palindr... |
python_sharegpt_23k | 22,491 | Write a Python function to sort a list of words in alphabetical order and concatenate them into a sentence. The function should handle lists of varying lengths and ensure that the resulting sentence is grammatically correct by placing the words in the correct order.
The code should start with:
```python
from typing im... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def sort_and_form_sentence(words: List[str]) -> str:
"""
Sorts a list of words in alphabetical order and concatenates them into a sentence.
Args:
words (List[str]): A list of words to be sor... |
python_sharegpt_23k | 22,493 | Write a Python function to reverse the order of characters in a given string. The function should take a string as input and return the reversed string. The code should start with:
```python
def reverse_string(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 order of characters in a given string.
Args:
s (str): The input string to be reversed.
Returns:
str: The reversed string.
"""
# Use string sli... |
python_sharegpt_23k | 22,495 | Write a Python function to sort a list of chemical elements based on their atomic numbers. Each element is represented as a dictionary with keys 'name' and 'atomic_number'. The function should return a list of elements sorted in increasing order of atomic number.
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 List, Dict
def sort_elements_by_atomic_number(elements: List[Dict[str, any]]) -> List[Dict[str, any]]:
"""
Sorts a list of chemical elements based on their atomic numbers.
Args:
elements (List[Di... |
python_sharegpt_23k | 22,502 | Write a Python function to generate all possible chords of a given scale, where each chord consists of three notes. The scale is represented as a list of notes. The function should return a list of lists, where each inner list contains three notes representing a chord.
The code should start with:
```python
from typing... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import itertools
def generate_chords(scale: List[str]) -> List[List[str]]:
"""
Generate all possible chords of a given scale, where each chord consists of three notes.
Args:
scale (List[str]... |
python_sharegpt_23k | 22,510 | Write a Python function to find the top three most popular vegetables from a given list of vegetables and their respective popularity rankings. The input will be a list of tuples, where each tuple contains the name of a vegetable and its popularity ranking. The function should return a list of the names of the top thre... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Tuple
def find_top_three_vegetables(vegetables: List[Tuple[str, int]]) -> List[str]:
"""
Finds the top three most popular vegetables from a given list of vegetables and their popularity rankings.
A... |
python_sharegpt_23k | 22,511 | Write a Python function to create an array of a specified size filled with random numbers within a given range using the NumPy library. The function should return the generated array.
The code should start with:
```python
import numpy as np
from typing import List
def generate_random_array(size: int, low: int, high: ... | Here is the Python code to solve the given problem in the markdown block:
```python
import numpy as np
from typing import List
def generate_random_array(size: int, low: int, high: int) -> List[int]:
"""
Generates an array of a specified size filled with random numbers within a given range.
Args:
s... |
python_sharegpt_23k | 22,513 | Write a Python function to generate a random Shakespearean insult along with its meaning. The function should randomly select an insult from a predefined list of insults and their meanings. The code should start with:
```python
from typing import Tuple
import random
def generate_random_insult() -> Tuple[str, str]:
```... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import Tuple
import random
def generate_random_insult() -> Tuple[str, str]:
"""
Generates a random Shakespearean insult along with its meaning.
Returns:
Tuple[str, str]: A tuple containing the random in... |
python_sharegpt_23k | 22,518 | Write a Python function to analyze and compare the relative moisture levels of two different types of soil, one found in a rainforest and the other in a desert. The function should use a suitable formula to calculate the relative moisture level and return a comprehensive report. The code should start with:
```python
fr... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import Tuple
def analyze_soil_moisture(rainforest_saturated_weight: float, rainforest_dry_weight: float, rainforest_current_weight: float,
desert_saturated_weight: float, desert_dry_weight: float, ... |
python_sharegpt_23k | 22,519 | Write a Python function to find the most recent date from a list of dates in the format "YYYY-MM-DD". The function should handle any valid date strings in the specified format and return the most recent date.
The code should start with:
```python
from typing import List
def get_most_recent_date(dates: List[str]) -> s... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def get_most_recent_date(dates: List[str]) -> str:
"""
Finds the most recent date from a list of dates in the format "YYYY-MM-DD".
Args:
dates (List[str]): A list of date strings in the form... |
python_sharegpt_23k | 22,521 | Write a Python function to generate a random sci-fi protagonist's character profile. The profile should include the following attributes: Name (string), Age (integer between 25 and 50), Gender (either "male" or "female"), Species (string), Occupation (string), Strength (integer between 1 and 8), Intelligence (integer b... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import Dict
import random
def generate_character_profile() -> Dict[str, str]:
"""
Generates a random sci-fi protagonist's character profile.
Returns:
Dict[str, str]: A dictionary containing the characte... |
python_sharegpt_23k | 22,524 | Write a Python function to generate a list of five positive physical traits randomly selected from a predefined list of options. The function should return the list of selected traits. The predefined list of traits includes:
- Bright eyes
- Thick hair
- Rosy cheeks
- Long legs
- Straight teeth
- Clear skin
- Broad shou... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import random
def generate_random_traits() -> List[str]:
"""
Generates a list of five positive physical traits randomly selected from a predefined list.
Returns:
List[str]: A list containing... |
python_sharegpt_23k | 22,526 | Write a Python function to remove all alphabetic characters from a given alphanumeric string and return the resulting numeric string. The function should handle strings of varying lengths and ensure that only numeric characters are retained in the output.
The code should start with:
```python
def remove_alphabets(s: s... | Here is the Python code to solve the given problem in the markdown block:
```python
def remove_alphabets(s: str) -> str:
"""
Removes all alphabetic characters from the given alphanumeric string and returns the resulting numeric string.
Args:
s (str): The alphanumeric string from which alphabetic ch... |
python_sharegpt_23k | 22,534 | 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 | 22,538 | Write a Python function to generate a haiku with a specific theme or subject. The haiku should consist of three lines with syllable counts of 5, 7, and 5 respectively. The function should take a theme as input and return the haiku as a string. The code should start with:
```python
import random
from typing import List
... | Here is the Python code to solve the given problem in the markdown block:
```python
import random
from typing import List
def generate_haiku(theme: str) -> str:
"""
Generates a haiku with a specific theme. The haiku consists of three lines with syllable counts of 5, 7, and 5 respectively.
Args:
th... |
python_sharegpt_23k | 22,539 | Write a Python function to measure the time it takes to print a string of varying lengths and to explore different formatting options such as font size and color. The function should also discuss potential memory constraints and optimization techniques for the string printing process. The code should start with:
```pyt... | Here is the Python code to solve the given problem in the markdown block:
```python
import time
def measure_print_time(string: str) -> float:
"""
Measures the time it takes to print a given string and explores different formatting options.
Args:
string (str): The string to be printed.
Returns... |
python_sharegpt_23k | 22,541 | Write a Python function to perform non-deterministic decision-making on a given dataset. The function should randomly select an item from the dataset, shuffle the dataset, and generate a random number within a specified range. The function should return a tuple containing the randomly selected item, the shuffled datase... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Tuple
import random
def non_deterministic_decision_making(dataset: List[int], min_range: int, max_range: int) -> Tuple[int, List[int], int]:
"""
Perform non-deterministic decision-making on a given data... |
python_sharegpt_23k | 22,551 | Write a Python function named `concatenate_words` that accepts a string named `text` as an argument. The function should split the input string into individual words and then concatenate them using underscores to create a single string. The output string should be returned by the function. Ensure that the output string... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def concatenate_words(text: str) -> str:
"""
Concatenates words from the input string using underscores.
Args:
text (str): The input string containing words to be concatenated.
Returns:
str: ... |
python_sharegpt_23k | 22,553 | Write a Python function to remove all occurrences of a specific word or phrase from a given text, irrespective of its case sensitivity or presence of special characters. The function should return the modified text after removing the specified word or phrase.
The code should start with:
```python
import re
def remove... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def remove_word_from_text(text: str, word: str) -> str:
"""
Removes all occurrences of a specific word or phrase from a given text, irrespective of its case sensitivity or presence of special characters.
Args:
... |
python_sharegpt_23k | 22,560 | Write a Python function that calculates the sum and average of three given numbers, and prints the factors of each number up to 20. The function should return the sum and average of the numbers. Additionally, provide a brief explanation of the significance of these three numbers in the context of their respective histo... | Here is the Python code to solve the given problem in the markdown block:
```python
def calculate_sum_avg_factors(num1: int, num2: int, num3: int) -> tuple:
"""
Calculate the sum and average of three given numbers, print the factors of each number up to 20,
and return the sum and average.
Args:
... |
python_sharegpt_23k | 22,566 | Write a Python function to generate a sentence that uses the words "defy" and "gravity" from a predefined list of verbs and nouns. The function should randomly select a verb and a noun from their respective lists and construct a sentence using the format "I will {verb} the {noun}." 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
import random
def generate_sentence(verbs: List[str], nouns: List[str]) -> str:
"""
Generates a sentence using a randomly selected verb and noun from the provided lists.
Args:
verbs (List[st... |
python_sharegpt_23k | 22,573 | Write a Python function to select a random constellation from a predefined list of constellations that are associated with love, beauty, and eternity. The function should return the selected constellation as a string. Additionally, write a function to generate a chorus line for a love song using the selected constellat... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import random
def select_constellation(constellations: List[str]) -> str:
"""
Selects a random constellation from a list of constellations associated with love, beauty, and eternity.
Args:
c... |
python_sharegpt_23k | 22,578 | Write a Python function to generate a sentence that demands an adverb for the verb "run" and produce an adverb for it using a list of predefined adverbs. The function should return the generated sentence as a string.
The code should start with:
```python
from typing import List
def generate_sentence_with_adverb(adver... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import random
def generate_sentence_with_adverb(adverbs: List[str]) -> str:
"""
Generates a sentence that demands an adverb for the verb "run" and produces an adverb for it.
Args:
adverbs (L... |
python_sharegpt_23k | 22,580 | Write a Python function to generate a random historical figure joke from a predefined list of jokes. The function should randomly select one joke from the list and return it. The list should include at least 10 jokes involving various historical figures. The function 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
import random
def get_random_historical_joke(jokes: List[str]) -> str:
"""
Generates a random historical figure joke from a given list of jokes.
Args:
jokes (List[str]): A list of strings wh... |
python_sharegpt_23k | 22,586 | Write a Python function to efficiently calculate the Euclidean distance between two points in an n-dimensional space using list comprehension. The function should take two tuples as input, each representing the coordinates of a point, and return a float representing the distance between these points. The function shoul... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import Tuple
import math
def euclidean_distance(point1: Tuple[float], point2: Tuple[float]) -> float:
"""
Calculate the Euclidean distance between two points in an n-dimensional space.
Args:
point1 (Tup... |
python_sharegpt_23k | 22,590 | Write a Python function to convert a temperature from Fahrenheit to Celsius. The function should take a single argument representing the temperature in Fahrenheit and return the corresponding temperature in Celsius. The code should start with:
```python
def fahrenheit_to_celsius(fahrenheit: float) -> float:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def fahrenheit_to_celsius(fahrenheit: float) -> float:
"""
Converts a temperature from Fahrenheit to Celsius.
Args:
fahrenheit (float): The temperature in Fahrenheit to be converted.
Returns:
float: The... |
python_sharegpt_23k | 22,593 | 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 List
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.
Arg... |
python_sharegpt_23k | 22,595 | 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:
def sum_... | 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 | 22,597 | 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 | 22,598 | Write a Python function to generate the next number in a given sequence based on a mathematical pattern. The sequence provided is: 2, 6, 14, 30, 62. The function should identify the pattern and compute the next number in the sequence.
The code should start with:
```python
def next_number_in_sequence(previous_number: i... | Here is the Python code to solve the given problem in the markdown block:
```python
def next_number_in_sequence(previous_number: int) -> int:
"""
Calculate the next number in the sequence based on the given pattern.
The sequence follows the pattern where each number is derived by doubling the previous numb... |
python_sharegpt_23k | 22,599 | 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 | 22,602 | Write a Python function to extract the original words from a sequence of transformed words, where each word has a common prefix "drove" and a unique suffix following the pattern "verb-noun". The function should return the original words in the correct sequence.
The code should start with:
```python
def extract_origina... | Here is the Python code to solve the given problem in the markdown block:
```python
def extract_original_words(transformed_words: str) -> str:
"""
Extracts the original words from a sequence of transformed words.
Each transformed word has a common prefix "drove" and a unique suffix following the pattern "v... |
python_sharegpt_23k | 22,605 | Write a Python function to generate a random numerical sequence of exactly eight digits, where each digit follows a Gaussian distribution with a specified mean and standard deviation. The function should ensure that the generated digits are within the valid range of 0 to 9.
The code should start with:
```python
from t... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
import random
import math
def generate_gaussian_sequence(mean: float, stddev: float) -> List[int]:
"""
Generates a random numerical sequence of exactly eight digits, where each digit follows a Gaussian d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.