source stringclasses 6
values | id int64 0 111k | instruction stringlengths 167 4.39k | response stringlengths 244 6.1k |
|---|---|---|---|
code_exercise_27k | 1,272 | Write a Python function to determine if a given string is a palindrome. A palindrome is a string that reads the same forwards and backwards, ignoring case and non-alphanumeric characters. The function should start with:
```python
def is_palindrome(string: str) -> bool:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def is_palindrome(string: str) -> bool:
"""
Determine if a given string is a palindrome, ignoring case and non-alphanumeric characters.
Args:
string (str): The input string to check.
Returns:
bool: True... |
code_exercise_27k | 1,273 | Write a Python function to count the number of vowels in a given string. The function should be case-insensitive and should consider both uppercase and lowercase vowels. The code should start with:
```python
def count_vowels(string: str) -> int:
```
| Here is the Python code to solve the given problem in the markdown block:
:
```python
def count_vowels(string: str) -> int:
"""
Counts the number of vowels in a given string.
Args:
string (str): The input string to count vowels from.
Returns:
int: The number of vowels in the string.
... |
code_exercise_27k | 1,274 | Write a Python function to reverse the order of words in a given string. The function should handle various edge cases, such as empty strings, strings with only one word, and strings with multiple spaces between words. The code should start with:
```python
def reverse_words(string: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words(string: str) -> str:
"""
Reverses the order of words in a given string.
Args:
string (str): The input string containing words to be reversed.
Returns:
str: A new string with the words ... |
code_exercise_27k | 1,275 | Write a Python function to remove duplicate characters from a given string while maintaining the original order of the remaining characters. The function should return a new string with all duplicate characters removed.
The code should start with:
```python
def remove_duplicates(string: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def remove_duplicates(string: str) -> str:
"""
Removes duplicate characters from the given string while maintaining the original order of the remaining characters.
Args:
string (str): The input string from which dup... |
code_exercise_27k | 1,276 | Write a Python function to capitalize the first letter of each word in a given string while keeping the rest of the word in lowercase. The function should handle various edge cases, such as empty strings, strings with multiple spaces, and strings with punctuation.
The code should start with:
```python
def capitalize_w... | Here is the Python code to solve the given problem in the markdown block:
```python
def capitalize_words(string: str) -> str:
"""
Capitalizes the first letter of each word in the given string while keeping the rest of the word in lowercase.
Args:
string (str): The input string to be processed.
... |
code_exercise_27k | 1,277 | Write a Python function to reverse the order of characters in a given string. The function should handle various edge cases, such as an empty string, a single character string, and a string with multiple characters. The function should not modify the original string but return a new string with the characters in revers... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_string(string: str) -> str:
"""
Reverses the order of characters in a given string.
Args:
string (str): The input string to be reversed.
Returns:
str: A new string with the characters in rev... |
code_exercise_27k | 1,279 | Write a Python function to determine if two given strings are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. The function should ignore case and any non-alphabetic characters. The code should ... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_anagram(string1: str, string2: str) -> bool:
"""
Determines if two strings are anagrams of each other, ignoring case and non-alphabetic characters.
Args:
string1 (str): The first string to compare.
st... |
code_exercise_27k | 1,283 | Write a Python function to reverse the order of words in a given string while maintaining the original case of each word. The function should be case-insensitive when reversing the words, meaning that uppercase and lowercase characters should be considered the same during the reversal process. The function should start... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words_case_insensitive(string: str) -> str:
"""
Reverses the order of words in a given string while maintaining the original case of each word.
The comparison for reversing the words is case-insensitive.
Arg... |
code_exercise_27k | 1,286 | Write a Python function to replace all occurrences of a target character in a main string with a replacement character. The function should handle edge cases such as empty strings, target character not present in the main string, and replacement character being the same as the target character. The code should start wi... | Here is the Python code to solve the given problem in the markdown block:
```python
def replace_characters(main_string: str, target_character: str, replacement_character: str) -> str:
"""
Replaces all occurrences of a target character in a main string with a replacement character.
Args:
main_string... |
code_exercise_27k | 1,288 | Write a Python function to remove duplicate characters from a given sorted string while maintaining the original order of the remaining characters. The input string is guaranteed to be sorted in ascending order. The function should return a new string with all duplicate characters removed.
The code should start with:
... | Here is the Python code to solve the given problem in the markdown block:
```python
def remove_duplicates_sorted(string: str) -> str:
"""
Removes duplicate characters from a given sorted string while maintaining the original order of the remaining characters.
Args:
string (str): The input sorted st... |
code_exercise_27k | 1,289 | Write a Python function to determine if two strings are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. The function should take two strings as input and return `True` if the strings are anagra... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_anagram(string1: str, string2: str) -> bool:
"""
Determines if two strings are anagrams of each other.
Args:
string1 (str): The first string to compare.
string2 (str): The second string to compare.
... |
code_exercise_27k | 1,295 | Write a Python function to determine if one string is a rotation of another string, considering that both strings are sorted in ascending order. The function should return `True` if one string is a rotation of the other, and `False` otherwise. The function should start with:
```python
def is_rotation_sorted(string1: st... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_rotation_sorted(string1: str, string2: str) -> bool:
"""
Determines if one string is a rotation of another string, considering that both strings are sorted in ascending order.
Args:
string1 (str): The first s... |
code_exercise_27k | 1,299 | Write a Python function to determine if two given strings are anagrams of each other. The function should be case-sensitive, meaning that uppercase and lowercase characters should be considered different. The function should return `True` if the two strings are anagrams, and `False` otherwise.
The code should start wi... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_anagram(string1: str, string2: str) -> bool:
"""
Determines if two given strings are anagrams of each other.
Args:
string1 (str): The first string to compare.
string2 (str): The second string to compa... |
code_exercise_27k | 1,300 | Write a Python function to replace all spaces in a given string with underscores "_" while maintaining case sensitivity. The function should handle various edge cases, such as empty strings, strings with no spaces, and strings with multiple consecutive spaces. The function should start with:
```python
def replace_space... | Here is the Python code to solve the given problem in the markdown block:
```python
def replace_spaces(string: str) -> str:
"""
Replaces all spaces in the given string with underscores.
Args:
string (str): The input string where spaces need to be replaced.
Returns:
str: A new string wi... |
code_exercise_27k | 1,301 | Write a Python function to determine if one string is a rotation of another string. A rotation occurs when one string can be obtained by rotating the other string by any number of positions. The comparison should be case-sensitive.
The code should start with:
```python
def is_rotation(string1: str, string2: str) -> bo... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_rotation(string1: str, string2: str) -> bool:
"""
Determines if one string is a rotation of another string.
Args:
string1 (str): The first string to compare.
string2 (str): The second string to compar... |
code_exercise_27k | 1,303 | Write a Python function called `replace_spaces_case_insensitive` that takes a string as input and returns a new string where all spaces are replaced with underscores "_". The comparison should be case-insensitive, meaning that uppercase and lowercase characters should be considered the same. The function should handle ... | Here is the Python code to solve the given problem in the markdown block:
```python
def replace_spaces_case_insensitive(string: str) -> str:
"""
Replaces all spaces in the input string with underscores "_" in a case-insensitive manner.
Args:
string (str): The input string where spaces need to be re... |
code_exercise_27k | 1,304 | Write a Python function called `reverse_string_case_insensitive` that takes a string as input and returns a new string where the order of the characters is reversed. The comparison should be case-insensitive, meaning that uppercase and lowercase characters should be considered the same. The function should handle both ... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_string_case_insensitive(string: str) -> str:
"""
Reverses the order of characters in a string while considering case-insensitivity.
Non-alphabetical characters retain their original positions.
Args:
... |
code_exercise_27k | 1,306 | Write a Python function to count the number of times a substring appears in a main string. The function should be case-sensitive, meaning that uppercase and lowercase characters should be considered different. The function should start with:
```python
def count_substring(main_string: str, substring: str) -> int:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def count_substring(main_string: str, substring: str) -> int:
"""
Counts the number of times a substring appears in a main string.
Args:
main_string (str): The main string in which to search for the substring.
... |
code_exercise_27k | 1,307 | Write a Python function called `replace_characters` that takes three strings as input: a main string, a target character, and a replacement character. The function should return a new string where all occurrences of the target character in the main string are replaced with the replacement character. The comparison shou... | Here is the Python code to solve the given problem in the markdown block:
```python
def replace_characters(main_string: str, target_character: str, replacement_character: str) -> str:
"""
Replaces all occurrences of a target character in a main string with a replacement character.
Args:
main_string... |
code_exercise_27k | 1,309 | Write a Python function to count the number of vowels in a given string. The function should be case-insensitive, meaning it should count both uppercase and lowercase vowels. The code should start with:
```python
def count_vowels(input_string: str) -> int:
```
| Here is the Python code to solve the given problem in the markdown block:
:
```python
def count_vowels(input_string: str) -> int:
"""
Counts the number of vowels (a, e, i, o, u) in the given input string.
Args:
input_string (str): The string in which to count the vowels.
Returns:
int: ... |
code_exercise_27k | 1,310 | Write a Python function to determine if a given string is a palindrome. A palindrome is a string that reads the same forwards and backwards. The function should ignore case and non-alphanumeric characters when checking for palindrome properties.
The code should start with:
```python
def is_palindrome(input_string: str... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_palindrome(input_string: str) -> bool:
"""
Determine if the given string is a palindrome, ignoring case and non-alphanumeric characters.
Args:
input_string (str): The string to check for palindrome properties... |
code_exercise_27k | 1,311 | Write a Python function to remove duplicate characters from a given string while maintaining the original order of characters. The function should return a new string with all duplicate characters removed. The code should start with:
```python
def remove_duplicates(input_string: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def remove_duplicates(input_string: str) -> str:
"""
Removes duplicate characters from the given string while maintaining the original order of characters.
Args:
input_string (str): The input string from which dupli... |
code_exercise_27k | 1,312 | Write a Python function named `capitalize_words` that takes a string as input and returns a new string with the first letter of each word capitalized. The function should handle various edge cases, such as empty strings, strings with multiple spaces, and strings with punctuation.
The code should start with:
```python
... | Here is the Python code to solve the given problem in the markdown block:
```python
def capitalize_words(input_string: str) -> str:
"""
Capitalizes the first letter of each word in the given string.
Args:
input_string (str): The input string to be processed.
Returns:
str: A new string ... |
code_exercise_27k | 1,313 | Write a Python function named `reverse_words` that takes a string as input and returns a new string with the order of words reversed. The function should handle various edge cases, such as an empty string, a string with only one word, and a string with multiple spaces between words. The function should also ensure that... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words(input_string: str) -> str:
"""
Reverses the order of words in the given input string.
Args:
input_string (str): The input string containing words to be reversed.
Returns:
str: A new st... |
code_exercise_27k | 1,314 | Write a Python function named `count_words` that takes a string as input and returns the number of words in the input string. The function should handle various edge cases, such as empty strings, strings with only whitespace, and strings with multiple spaces between words. The function should also handle punctuation as... | Here is the Python code to solve the given problem in the markdown block:
```python
def count_words(input_string: str) -> int:
"""
Counts the number of words in the given input string.
Args:
input_string (str): The input string to count words from.
Returns:
int: The number of words in ... |
code_exercise_27k | 1,315 | Write a Python function to determine if two given strings are anagrams of each other. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. The function should ignore case and any non-alphabetic characters.
The code should... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_anagram(string1: str, string2: str) -> bool:
"""
Determines if two strings are anagrams of each other, ignoring case and non-alphabetic characters.
Args:
string1 (str): The first string to compare.
st... |
code_exercise_27k | 1,316 | Write a Python function named `replace_spaces` that takes a string as input and returns a new string where all spaces are replaced with underscores `_`. The function should handle various edge cases, such as empty strings, strings with no spaces, and strings with multiple consecutive spaces.
The code should start with... | Here is the Python code to solve the given problem in the markdown block:
```python
def replace_spaces(input_string: str) -> str:
"""
Replaces all spaces in the input string with underscores.
Args:
input_string (str): The input string to be processed.
Returns:
str: A new string where a... |
code_exercise_27k | 1,317 | Write a Python function to determine if a given string is a pangram. A pangram is a sentence that contains every letter of the alphabet at least once. The function should be case-insensitive and should ignore non-alphabetic characters.
The code should start with:
```python
import string
def is_pangram(input_string: s... | Here is the Python code to solve the given problem in the markdown block:
```python
import string
def is_pangram(input_string: str) -> bool:
"""
Determine if the given input string is a pangram.
A pangram is a sentence that contains every letter of the alphabet at least once.
This function is case-ins... |
code_exercise_27k | 1,318 | Write a Python function named `remove_duplicates_case_insensitive` that takes a string as input and returns a new string with all duplicate characters removed, while ignoring case sensitivity. Maintain the original order of characters. The function should start with:
```python
def remove_duplicates_case_insensitive(inp... | Here is the Python code to solve the given problem in the markdown block:
```python
def remove_duplicates_case_insensitive(input_string: str) -> str:
"""
Removes duplicate characters from the input string while ignoring case sensitivity and maintaining the original order of characters.
Args:
input_... |
code_exercise_27k | 1,321 | Write a Python function named `is_numeric` that takes a string as input and returns `True` if the input string represents a numeric value (either an integer or a floating-point number), and `False` otherwise. The function should handle positive and negative numbers, as well as numbers with a single decimal point. The f... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_numeric(input_string: str) -> bool:
"""
Determines if the input string represents a numeric value (integer or floating-point).
Args:
input_string (str): The string to be checked for numeric representation.
... |
code_exercise_27k | 1,323 | Write a Python function to determine if two given strings are anagrams of each other, ignoring case sensitivity. The function should return `True` if the strings are anagrams and `False` otherwise. The function should handle empty strings and strings with non-alphabetic characters.
The code should start with:
```pytho... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_anagram_case_insensitive(string1: str, string2: str) -> bool:
"""
Determines if two strings are anagrams of each other, ignoring case sensitivity and non-alphabetic characters.
Args:
string1 (str): The first ... |
code_exercise_27k | 1,324 | Write a Python function named `reverse_words_in_sentence` that takes a string as input and returns a new string where the order of words in the input sentence is reversed. The function should handle various edge cases, such as empty strings, strings with only one word, and strings with multiple spaces between words.
T... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words_in_sentence(input_string: str) -> str:
"""
Reverses the order of words in the input sentence.
Args:
input_string (str): The input sentence whose words are to be reversed.
Returns:
str:... |
code_exercise_27k | 1,326 | Write a Python function named `remove_special_characters` that takes a string as input and returns a new string with all special characters (non-alphanumeric characters) removed. The function should handle various edge cases, such as empty strings, strings with only special characters, and strings with no special chara... | Here is the Python code to solve the given problem in the markdown block:
```python
def remove_special_characters(input_string: str) -> str:
"""
Removes all special characters (non-alphanumeric characters) from the input string.
Args:
input_string (str): The input string from which special characte... |
code_exercise_27k | 1,332 | Write a Python function named `count_occurrences` that takes two strings as input: a main string and a target string. The function should return the number of non-overlapping occurrences of the target string within the main string. The function should handle edge cases such as empty strings and target strings longer th... | Here is the Python code to solve the given problem in the markdown block:
```python
def count_occurrences(main_string: str, target_string: str) -> int:
"""
Counts the number of non-overlapping occurrences of a target string within a main string.
Args:
main_string (str): The main string in which to ... |
code_exercise_27k | 1,336 | Write a Python function named `find_longest_common_prefix` that takes a list of strings as input and returns the longest common prefix among the strings. If there is no common prefix, return an empty string. The function should handle edge cases such as an empty list or a list with varying string lengths efficiently.
... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def find_longest_common_prefix(strings: List[str]) -> str:
"""
Finds the longest common prefix among a list of strings.
Args:
strings (List[str]): A list of strings to find the common prefix... |
code_exercise_27k | 1,337 | Write a Python function named `find_unique_characters` that takes a string as input and returns a new string containing only the unique characters from the input string. The order of the characters in the output string should match their order of occurrence in the input string. The function should handle an empty strin... | Here is the Python code to solve the given problem in the markdown block:
```python
def find_unique_characters(input_string: str) -> str:
"""
Returns a new string containing only the unique characters from the input string,
maintaining the order of their first occurrence.
Args:
input_string (st... |
code_exercise_27k | 1,339 | Write a Python function named `find_common_elements` that takes two lists as input and returns a new list containing the common elements between the two input lists. The order of the elements in the output list should match their order of occurrence in the first input list. The function should handle lists of any data ... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Any
def find_common_elements(list1: List[Any], list2: List[Any]) -> List[Any]:
"""
Finds the common elements between two lists and returns them in the order of their first occurrence in the first list.
... |
code_exercise_27k | 1,347 | Write a Python function named `find_unique_elements` that takes a list as input and returns a new list containing only the unique elements from the input list. The order of the elements in the output list should match their order of occurrence in the input list. The function should handle lists of any data type, includ... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Any
def find_unique_elements(input_list: List[Any]) -> List[Any]:
"""
Returns a list of unique elements from the input list, preserving the order of their first occurrence.
Args:
input_list... |
code_exercise_27k | 1,348 | Write a Python function named `find_missing_numbers` that takes two lists of integers as input and returns a new list containing the numbers that are present in the first list but not in the second list. The order of the numbers in the output list should match their order of occurrence in the first list. The function s... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def find_missing_numbers(list1: List[int], list2: List[int]) -> List[int]:
"""
Returns a list of numbers that are present in the first list but not in the second list.
Args:
list1 (List[int]... |
code_exercise_27k | 1,349 | Write a Python function named `find_common_numbers` that takes two lists of integers as input and returns a new list containing the numbers that are present in both input lists. The order of the numbers in the output list should match their order of occurrence in the first input list. The function should handle cases w... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def find_common_numbers(list1: List[int], list2: List[int]) -> List[int]:
"""
Finds the common numbers between two lists of integers and returns them in the order of their first occurrence in the first l... |
code_exercise_27k | 1,352 | Write a Python function named `find_missing_elements_case_insensitive_space_insensitive` that takes two lists of strings as input and returns a new list containing the elements that are present in the first list but not in the second list, considering case insensitivity and space insensitivity. The order of the element... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def find_missing_elements_case_insensitive_space_insensitive(list1: List[str], list2: List[str]) -> List[str]:
"""
Returns a list of elements that are present in the first list but not in the second list... |
code_exercise_27k | 1,354 | Write a Python function named `capitalize_words` that takes a string as input and returns the string with the first letter of each word capitalized. The function should handle various edge cases, such as empty strings, strings with multiple spaces, and strings with punctuation. The code should start with:
```python
def... | Here is the Python code to solve the given problem in the markdown block:
```python
def capitalize_words(input_string: str) -> str:
"""
Capitalizes the first letter of each word in the given string.
Args:
input_string (str): The input string to be processed.
Returns:
str: The input str... |
code_exercise_27k | 1,356 | Write a Python function named `is_palindrome` that takes a string as input and returns `True` if the string is a palindrome (reads the same forwards and backwards), and `False` otherwise. The function should ignore case sensitivity and non-alphanumeric characters when determining if the string is a palindrome.
The cod... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_palindrome(input_string: str) -> bool:
"""
Determines if the given string is a palindrome, ignoring case sensitivity and non-alphanumeric characters.
Args:
input_string (str): The string to check for palindro... |
code_exercise_27k | 1,357 | Write a Python function named `replace_spaces` that takes a string as input and returns the string with all spaces replaced by underscores. The function should handle various edge cases, such as empty strings, strings with no spaces, and strings with multiple spaces. The code should start with:
```python
def replace_sp... | Here is the Python code to solve the given problem in the markdown block:
```python
def replace_spaces(input_string: str) -> str:
"""
Replaces all spaces in the input string with underscores.
Args:
input_string (str): The input string to be processed.
Returns:
str: The input string wit... |
code_exercise_27k | 1,358 | Write a Python function named `count_words` that takes a string as input and returns the number of words in the string. Assume that words are separated by spaces. The function should handle various edge cases, such as empty strings, strings with multiple spaces, and strings with leading or trailing spaces. The code sho... | Here is the Python code to solve the given problem in the markdown block:
```python
def count_words(input_string: str) -> int:
"""
Counts the number of words in a given string. Words are assumed to be separated by spaces.
Args:
input_string (str): The input string to count words from.
Returns:... |
code_exercise_27k | 1,359 | Write a Python function named `reverse_words` that takes a string as input and returns the string with the order of the words reversed. Assume that words are separated by spaces. The function should handle cases where the input string is empty or contains only spaces. The code should start with:
```python
def reverse_w... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words(input_string: str) -> str:
"""
Reverses the order of words in a given string.
Args:
input_string (str): The input string containing words separated by spaces.
Returns:
str: A string wi... |
code_exercise_27k | 1,361 | Write a Python function named `remove_whitespace` that takes a string as input and returns the string with all whitespace characters (spaces, tabs, and newlines) removed. The function should handle various types of whitespace characters and return the modified string.
The code should start with:
```python
def remove_w... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def remove_whitespace(input_string: str) -> str:
"""
Removes all whitespace characters (spaces, tabs, and newlines) from the given input string.
Args:
input_string (str): The input string from which white... |
code_exercise_27k | 1,362 | Write a Python function named `is_anagram` that takes two strings as input and returns `True` if the two strings are anagrams of each other (contain the same characters in a different order), and `False` otherwise. The function should be case-insensitive and should ignore spaces and punctuation.
The code should start ... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_anagram(string1: str, string2: str) -> bool:
"""
Determines if two strings are anagrams of each other, ignoring case, spaces, and punctuation.
Args:
string1 (str): The first string to compare.
string2... |
code_exercise_27k | 1,363 | Write a Python function named `find_substring` that takes two strings as input and returns `True` if the first string contains the second string as a substring, and `False` otherwise. The function should be case-sensitive and should handle edge cases such as empty strings and strings with special characters.
The code ... | Here is the Python code to solve the given problem in the markdown block:
```python
def find_substring(string1: str, string2: str) -> bool:
"""
Determines if the second string is a substring of the first string.
Args:
string1 (str): The main string in which to search for the substring.
stri... |
code_exercise_27k | 1,364 | Write a Python function named `split_string` that takes a string and a delimiter as input and returns a list of substrings split by the delimiter. The function should handle the following cases:
1. If the input string is `None`, the function should return an empty list.
2. If the delimiter is `None`, the function shoul... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List, Optional
def split_string(input_string: Optional[str], delimiter: Optional[str]) -> List[str]:
"""
Splits the input string by the given delimiter and returns a list of substrings.
Args:
inp... |
code_exercise_27k | 1,368 | Write a Python function named `capitalize_first_letter` that takes a string as input and returns the string with the first letter of each word capitalized, while keeping the rest of the letters lowercase. The function should handle various edge cases, such as empty strings, strings with only one word, and strings with ... | Here is the Python code to solve the given problem in the markdown block:
```python
def capitalize_first_letter(input_string: str) -> str:
"""
Capitalizes the first letter of each word in the input string while keeping the rest of the letters lowercase.
Args:
input_string (str): The input string to... |
code_exercise_27k | 1,369 | Write a Python function named `reverse_words_order` that takes a string as input and returns the string with the order of the words reversed. The function should handle various edge cases, such as empty strings, strings with only one word, and strings with multiple spaces between words. The code should start with:
```p... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words_order(input_string: str) -> str:
"""
Reverses the order of words in the given input string.
Args:
input_string (str): The input string containing words to be reversed.
Returns:
str: A ... |
code_exercise_27k | 1,370 | Write a Python function named `count_occurrences` that takes a string and a target substring as input and returns the number of non-overlapping occurrences of the target substring in the string. The function should handle edge cases such as empty strings and substrings that are longer than the input string.
The code s... | Here is the Python code to solve the given problem in the markdown block:
```python
def count_occurrences(input_string: str, target_substring: str) -> int:
"""
Counts the number of non-overlapping occurrences of a target substring in the input string.
Args:
input_string (str): The string in which t... |
code_exercise_27k | 1,372 | Write a Python function named `is_prefix` that takes two strings as input and returns `True` if the first string is a prefix of the second string, and `False` otherwise. The function should handle edge cases such as empty strings and should be efficient in checking the prefix.
The code should start with:
```python
def... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_prefix(prefix: str, string: str) -> bool:
"""
Determines if the first string is a prefix of the second string.
Args:
prefix (str): The string to check if it is a prefix.
string (str): The string to ch... |
code_exercise_27k | 1,373 | Write a Python function named `is_suffix` that takes two strings as input and returns `True` if the first string is a suffix of the second string, and `False` otherwise. The function should handle cases where the suffix is an empty string and should be case-sensitive.
The code should start with:
```python
def is_suffi... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_suffix(suffix: str, string: str) -> bool:
"""
Determines if the first string is a suffix of the second string.
Args:
suffix (str): The suffix to check.
string (str): The string to check against.
... |
code_exercise_27k | 1,374 | Write a Python function named `is_subsequence` that takes two strings as input and returns `True` if the first string is a subsequence of the second string, and `False` otherwise. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the rema... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_subsequence(subsequence: str, string: str) -> bool:
"""
Determines if the first string is a subsequence of the second string.
Args:
subsequence (str): The subsequence to check.
string (str): The strin... |
code_exercise_27k | 1,376 | Write a Python function named `is_rotation` that takes two strings as input and returns `True` if one string is a rotation of the other string, and `False` otherwise. A rotation occurs when one string can be obtained by rotating the other string by any number of positions.
The code should start with:
```python
def is_... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_rotation(string1: str, string2: str) -> bool:
"""
Determines if one string is a rotation of another string.
Args:
string1 (str): The first string to compare.
string2 (str): The second string to compar... |
code_exercise_27k | 1,377 | Write a Python function named `find_longest_common_prefix` that takes a list of strings as input and returns the longest common prefix among the strings. If there is no common prefix, the function should return an empty string. The function should handle cases where the input list is empty or contains strings of varyin... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import List
def find_longest_common_prefix(strings: List[str]) -> str:
"""
Finds the longest common prefix among a list of strings.
Args:
strings (List[str]): A list of strings to find the common prefix... |
code_exercise_27k | 1,378 | Write a Python function named `reverse_words_in_sentence` that takes a string as input and returns the string with the order of the words reversed, while keeping the order of the characters within each word unchanged. Assume that words are separated by spaces. The function should handle edge cases such as an empty stri... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words_in_sentence(sentence: str) -> str:
"""
Reverses the order of words in a given sentence while keeping the order of characters within each word unchanged.
Args:
sentence (str): The input sentence to ... |
code_exercise_27k | 1,379 | Write a Python function named `remove_adjacent_duplicates` that takes a string as input and returns the string with adjacent duplicate characters removed. Only the first occurrence of each duplicate character should be kept. The function should handle edge cases such as an empty string or a string with all identical ch... | Here is the Python code to solve the given problem in the markdown block:
```python
def remove_adjacent_duplicates(input_string: str) -> str:
"""
Removes adjacent duplicate characters from the input string.
Args:
input_string (str): The input string from which adjacent duplicates are to be removed.... |
code_exercise_27k | 1,381 | Write a Python function named `remove_non_alpha_chars` that takes a string as input and returns the string with all non-alphabetic characters removed. The function should handle both uppercase and lowercase alphabetic characters. The code should start with:
```python
def remove_non_alpha_chars(input_string: str) -> str... | Here is the Python code to solve the given problem in the markdown block:
```python
def remove_non_alpha_chars(input_string: str) -> str:
"""
Removes all non-alphabetic characters from the input string.
Args:
input_string (str): The input string from which non-alphabetic characters will be removed.... |
code_exercise_27k | 1,382 | Write a Python function named `is_palindrome_case_insensitive` that takes a string as input and returns `True` if the string is a palindrome (reads the same forwards and backwards), considering case insensitivity. The function should handle various edge cases, such as empty strings, strings with spaces, and strings wit... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_palindrome_case_insensitive(input_string: str) -> bool:
"""
Determines if the input string is a palindrome, considering case insensitivity and ignoring non-alphanumeric characters.
Args:
input_string (str): T... |
code_exercise_27k | 1,384 | Write a Python function named `remove_whitespace_and_punctuation` that takes a string as input and returns the string with all whitespace characters (spaces, tabs, and newlines) and punctuation characters removed. The function should handle various types of whitespace and punctuation efficiently.
The code should start... | Here is the Python code to solve the given problem in the markdown block:
```python
import string
def remove_whitespace_and_punctuation(input_string: str) -> str:
"""
Removes all whitespace and punctuation characters from the given input string.
Args:
input_string (str): The input string from whic... |
code_exercise_27k | 1,386 | Write a Python function named `find_most_frequent_character` that takes a string as input and returns the most frequent character in the string. If there are multiple characters with the same highest frequency, the function should return the character that appears first in the string. The function should handle an empt... | Here is the Python code to solve the given problem in the markdown block:
```python
def find_most_frequent_character(input_string: str) -> str:
"""
Finds the most frequent character in the given string. If there are multiple characters
with the same highest frequency, returns the character that appears firs... |
code_exercise_27k | 1,387 | Write a Python function to determine if the parentheses in a given string are balanced. Balanced parentheses mean that for every opening parenthesis, there is a corresponding closing parenthesis in the correct order. The function should handle three types of parentheses: round brackets `()`, square brackets `[]`, and c... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_balanced_parentheses(input_string: str) -> bool:
"""
Determine if the parentheses in the given string are balanced.
Args:
input_string (str): The string to check for balanced parentheses.
Returns:
... |
code_exercise_27k | 1,388 | Write a Python function named `find_longest_palindrome` that takes a string as input and returns the longest palindrome substring within the string. If there are multiple longest palindrome substrings, the function should return the one that appears first in the string. The function should handle edge cases such as emp... | Here is the Python code to solve the given problem in the markdown block:
```python
def find_longest_palindrome(input_string: str) -> str:
"""
Finds the longest palindrome substring within the given input string.
Args:
input_string (str): The input string to search for the longest palindrome substr... |
code_exercise_27k | 1,389 | Write a Python function named `is_substring_at_beginning` that takes two strings as input: the target substring and the string to search in. The function should return `True` if the target substring appears at the beginning of the string, and `False` otherwise. The function should handle edge cases such as empty string... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_substring_at_beginning(target_substring: str, string: str) -> bool:
"""
Determines if the target substring appears at the beginning of the given string.
Args:
target_substring (str): The substring to check fo... |
code_exercise_27k | 1,393 | Write a Python function named `is_substring` that takes two strings as input: the target substring and the string to search in. The function should return `True` if the target substring appears in the string, and `False` otherwise. The function should handle edge cases such as empty strings and case sensitivity.
The c... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_substring(target_substring: str, string: str) -> bool:
"""
Determines if the target substring appears in the given string.
Args:
target_substring (str): The substring to search for.
string (str): The ... |
code_exercise_27k | 1,395 | Write a Python function named `is_substring_at_any_position` that takes two strings as input: the target substring and the string to search in. The function should return `True` if the target substring appears at any position in the string, and `False` otherwise. The function should be case-sensitive and should not use... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_substring_at_any_position(target_substring: str, string: str) -> bool:
"""
Checks if the target substring appears at any position in the given string.
Args:
target_substring (str): The substring to search for... |
code_exercise_27k | 1,400 | Write a Python function named `is_substring_at_any_position_case_insensitive` that takes two strings as input: the target substring and the string to search in. The function should return `True` if the target substring appears at any position in the string, in a case-insensitive manner, and `False` otherwise. The funct... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_substring_at_any_position_case_insensitive(target_substring: str, string: str) -> bool:
"""
Checks if the target substring appears at any position in the given string in a case-insensitive manner.
Args:
targe... |
code_exercise_27k | 1,403 | Write a Python function to convert a given string to uppercase and handle special cases such as an empty string and `None`. The function should return `None` if the input is `None` and an empty string if the input is an empty string. The code should start with:
```python
def convert_to_uppercase(input_string: str) -> s... | Here is the Python code to solve the given problem in the markdown block:
```python
def convert_to_uppercase(input_string: str) -> str:
"""
Converts the input string to uppercase. Returns None if the input is None,
and an empty string if the input is an empty string.
Args:
input_string (str): T... |
code_exercise_27k | 1,404 | Write a Python function to convert a given string to lowercase and remove all non-alphabetic characters. The function should handle both uppercase and lowercase alphabetic characters, and should return the cleaned string. The code should start with:
```python
def clean_and_lowercase(input_string: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def clean_and_lowercase(input_string: str) -> str:
"""
Converts the input string to lowercase and removes all non-alphabetic characters.
Args:
input_string (str): The string to be cleaned and converted.
Returns... |
code_exercise_27k | 1,405 | Write a Python function to capitalize the first letter of each word in a given string. The function should handle various edge cases, such as empty strings, strings with only one word, and strings with multiple words separated by spaces. The function should also handle strings with leading and trailing spaces.
The cod... | Here is the Python code to solve the given problem in the markdown block:
```python
def capitalize_each_word(input_string: str) -> str:
"""
Capitalizes the first letter of each word in the input string.
Args:
input_string (str): The string to be processed.
Returns:
str: The input strin... |
code_exercise_27k | 1,407 | Write a Python function to reverse the characters in a given string. The function should handle both non-empty and empty strings. The code should start with:
```python
def reverse_string(input_string: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
:
```python
def reverse_string(input_string: str) -> str:
"""
Reverses the characters in the input string.
Args:
input_string (str): The string to be reversed.
Returns:
str: The input string with the characters i... |
code_exercise_27k | 1,408 | Write a Python function to remove all whitespace characters from a given string, including spaces, tabs, and newline characters. The function should handle strings with various types of whitespace characters and return the cleaned string. The code should start with:
```python
def remove_all_whitespace(input_string: str... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def remove_all_whitespace(input_string: str) -> str:
"""
Removes all whitespace characters (spaces, tabs, newlines) from the input string.
Args:
input_string (str): The string from which all whitespace ch... |
code_exercise_27k | 1,409 | Write a Python function to remove all non-alphanumeric characters from a given string. The function should handle various types of non-alphanumeric characters, including spaces, punctuation, and special characters. The function should return the cleaned string.
The code should start with:
```python
import re
def remo... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def remove_non_alphanumeric(input_string: str) -> str:
"""
Removes all non-alphanumeric characters from the input string.
Args:
input_string (str): The string from which non-alphanumeric characters need t... |
code_exercise_27k | 1,410 | Write a Python function to replace all vowels in a given string with a specified character. The function should handle both uppercase and lowercase vowels. The code should start with:
```python
def replace_vowels(input_string: str, replacement_character: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def replace_vowels(input_string: str, replacement_character: str) -> str:
"""
Replaces all vowels in the input string with the specified character.
Args:
input_string (str): The string in which vowels need to be rep... |
code_exercise_27k | 1,411 | Write a Python function to count the number of occurrences of a specified substring within a given string, considering case insensitivity. The function should handle overlapping occurrences of the substring.
The code should start with:
```python
def count_substring_occurrences(input_string: str, substring: str) -> int... | Here is the Python code to solve the given problem in the markdown block:
```python
def count_substring_occurrences(input_string: str, substring: str) -> int:
"""
Counts the number of occurrences of a specified substring within a given string,
considering case insensitivity and overlapping occurrences.
... |
code_exercise_27k | 1,412 | Write a Python function to determine if a given string is a palindrome. A palindrome is a string that reads the same backward as forward, ignoring case and non-alphanumeric characters. The function should start with:
```python
def is_palindrome(input_string: str) -> bool:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_palindrome(input_string: str) -> bool:
"""
Determines if the given string is a palindrome, ignoring case and non-alphanumeric characters.
Args:
input_string (str): The string to check for palindrom... |
code_exercise_27k | 1,415 | Write a Python function to determine if a given string contains only numeric characters, including negative numbers and decimal points. The function should return `True` if the string represents a valid number (including negative numbers and floating-point numbers), and `False` otherwise.
The code should start with:
`... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_valid_number(input_string: str) -> bool:
"""
Determines if the input string represents a valid number, including negative numbers and floating-point numbers.
Args:
input_string (str): The string to... |
code_exercise_27k | 1,416 | Write a Python function to validate if a given string is a valid email address according to a specific pattern. The function should return `True` if the string is a valid email address and `False` otherwise. The email validation should follow these rules:
1. The email must contain exactly one `@` symbol.
2. The part be... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_valid_email(input_string: str) -> bool:
"""
Validates if the input string is a valid email address according to a specific pattern.
Parameters:
input_string (str): The string to check for email validit... |
code_exercise_27k | 1,417 | Write a Python function to remove all duplicate characters from a given string while preserving the order of the characters. The function should return the modified string. The code should start with:
```python
def remove_duplicate_characters(input_string: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
:
```python
def remove_duplicate_characters(input_string: str) -> str:
"""
Removes all duplicate characters from the input string while preserving the order of the characters.
Args:
input_string (str): The string from which d... |
code_exercise_27k | 1,420 | Write a Python function to reverse the order of words in a given string. The function should handle strings with multiple spaces between words and leading/trailing spaces. The code should start with:
```python
def reverse_word_order(input_string: str) -> str:
```
| Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_word_order(input_string: str) -> str:
"""
Reverses the order of words in the input string.
Args:
input_string (str): The string in which to reverse the word order.
Returns:
str: The input st... |
code_exercise_27k | 1,421 | Write a Python function to validate if a given string is a valid phone number in the format "XXX-XXX-XXXX", where 'X' is a digit. The function should return `True` if the string matches the format, and `False` otherwise. The code should start with:
```python
import re
def is_valid_phone_number(input_string: str) -> bo... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_valid_phone_number(input_string: str) -> bool:
"""
Validates if the input string is a valid phone number in the format "XXX-XXX-XXXX".
Args:
input_string (str): The string to validate as a phone nu... |
code_exercise_27k | 1,423 | Write a Python function to determine if a given string contains only uppercase letters, digits, and/or specific special characters (underscore `_`, hyphen `-`, and period `.`). The function should return `True` if the string meets the criteria, and `False` otherwise.
The code should start with:
```python
def contains_... | Here is the Python code to solve the given problem in the markdown block:
```python
def contains_only_allowed_characters(input_string: str) -> bool:
"""
Checks if the input string contains only uppercase letters, digits, and specific special characters.
Parameters:
input_string (str): The string to che... |
code_exercise_27k | 1,425 | Write a Python function to determine if a given string contains only lowercase letters and does not contain any digits, spaces, or special characters. The function should return `True` if the string meets the criteria, and `False` otherwise. The code should start with:
```python
def is_lowercase_only(input_string: str)... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_lowercase_only(input_string: str) -> bool:
"""
Determines if the input string contains only lowercase letters and no digits, spaces, or special characters.
Args:
input_string (str): The string to check.
... |
code_exercise_27k | 1,428 | Write a Python function to capitalize the first letter of each word in a given string. The function should handle various edge cases, such as empty strings, strings with only one word, and strings with multiple spaces between words. The function should also handle punctuation correctly, ensuring that only the first let... | Here is the Python code to solve the given problem in the markdown block:
```python
def capitalize_words(input_string: str) -> str:
"""
Capitalizes the first letter of each word in the input string.
Parameters:
input_string (str): The string to capitalize.
Returns:
str: The input string with t... |
code_exercise_27k | 1,429 | Write a Python function to validate if a given string is a valid date in the format "YYYY-MM-DD". The function should ensure that the date string not only matches the format but also represents a valid date (e.g., February 30th should be invalid). The function should return `True` if the date is valid and `False` other... | Here is the Python code to solve the given problem in the markdown block:
```python
from typing import Union
import re
from datetime import datetime
def is_valid_date(input_string: str) -> Union[bool, str]:
"""
Validates if the input string is a valid date in the format "YYYY-MM-DD".
Args:
input_s... |
code_exercise_27k | 1,431 | Write a Python function to validate if a given string is a valid credit card number. The credit card number should follow the format `XXXX-XXXX-XXXX-XXXX`, where `X` is a digit (0-9). The function should return `True` if the string matches this format, and `False` otherwise.
The code should start with:
```python
impor... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_valid_credit_card_number(input_string: str) -> bool:
"""
Validates if the input string is a valid credit card number in the format XXXX-XXXX-XXXX-XXXX.
Args:
input_string (str): The string to valid... |
code_exercise_27k | 1,432 | Write a Python function to encode a given string using the ROT13 cipher. The ROT13 cipher is a simple substitution cipher that replaces a letter with the 13th letter after it in the alphabet. The transformation should be applied to both uppercase and lowercase letters, while non-alphabetic characters should remain unch... | Here is the Python code to solve the given problem in the markdown block:
```python
def rot13_encode(input_string: str) -> str:
"""
Encodes the input string using the ROT13 cipher.
The ROT13 cipher shifts each letter by 13 positions in the alphabet.
Non-alphabetic characters remain unchanged.
Args... |
code_exercise_27k | 1,433 | Write a Python function to validate if a given string is a valid username according to the following rules:
1. The username must be between 3 and 16 characters long.
2. The username can only contain alphanumeric characters (a-z, A-Z, 0-9), underscores (_), and hyphens (-).
3. The username must start and end with an alp... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_valid_username(input_string: str) -> bool:
"""
Validates if the input string is a valid username according to the specified rules.
Parameters:
input_string (str): The string to check for username valid... |
code_exercise_27k | 1,434 | Write a Python function to decode a given string using the ROT13 cipher. The ROT13 cipher is a simple substitution cipher that replaces a letter with the 13th letter after it in the alphabet. The function should handle both uppercase and lowercase letters, and any non-alphabetic characters should remain unchanged.
The... | Here is the Python code to solve the given problem in the markdown block:
```python
def decode_rot13(input_string: str) -> str:
"""
Decodes the input string using the ROT13 cipher.
The ROT13 cipher is a simple substitution cipher that replaces a letter with the 13th letter after it in the alphabet.
Bot... |
code_exercise_27k | 1,437 | Write a Python function to determine if a given string is a valid hexadecimal number. A valid hexadecimal number consists of digits (0-9) and the letters (a-f or A-F). The function should return `True` if the string is a valid hexadecimal number and `False` otherwise. The code should start with:
```python
import re
de... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_valid_hexadecimal(input_string: str) -> bool:
"""
Determines if the input string is a valid hexadecimal number.
Args:
input_string (str): The string to check.
Returns:
bool: True if th... |
code_exercise_27k | 1,440 | Write a Python function to convert a given string into its Morse code representation. Each character in the string should be replaced by its corresponding Morse code symbol. The function should handle both uppercase and lowercase letters, digits, and spaces. The Morse code for each character should be separated by a sp... | Here is the Python code to solve the given problem in the markdown block:
```python
def convert_to_morse_code(input_string: str) -> str:
"""
Converts the given input string into its Morse code representation.
Parameters:
input_string (str): The string to be converted into Morse code.
Returns:
... |
code_exercise_27k | 1,441 | Write a Python function to determine if a given string is a valid palindrome, considering only alphanumeric characters and ignoring case sensitivity. The function should return `True` if the string is a valid palindrome and `False` otherwise. The code should start with:
```python
def is_valid_palindrome(input_string: s... | Here is the Python code to solve the given problem in the markdown block:
```python
def is_valid_palindrome(input_string: str) -> bool:
"""
Determines if the given string is a valid palindrome, considering only alphanumeric characters and ignoring case sensitivity.
Args:
input_string (str): The str... |
code_exercise_27k | 1,445 | Write a Python function to determine if a given string is a valid XML tag. An XML tag must start with `<`, end with `>`, and contain a tag name that starts with a letter or underscore, followed by any number of letters, digits, underscores, or hyphens. The tag may optionally include attributes and self-closing tags.
T... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_valid_xml_tag(input_string: str) -> bool:
"""
Determines if the input string is a valid XML tag.
An XML tag must start with `<`, end with `>`, and contain a tag name that starts with a letter or underscore... |
code_exercise_27k | 1,450 | Write a Python function that takes a string as input and returns a new string where each character in the input string is replaced by its corresponding hexadecimal representation. The hexadecimal representation should be in lowercase and should not include the '0x' prefix.
The code should start with:
```python
def rep... | Here is the Python code to solve the given problem in the markdown block:
```python
def replace_with_hexadecimal(input_string: str) -> str:
"""
Converts each character in the input string to its corresponding hexadecimal representation.
Args:
input_string (str): The string to convert.
Returns:... |
code_exercise_27k | 1,453 | Write a Python function named `capitalize_words` that takes a string as input and returns a new string where the first letter of each word is capitalized. Assume that words are separated by spaces and there are no punctuation marks. The function should handle edge cases such as empty strings and strings with only one w... | Here is the Python code to solve the given problem in the markdown block:
```python
def capitalize_words(input_string: str) -> str:
"""
Capitalizes the first letter of each word in the input string.
Args:
input_string (str): The input string where each word is separated by spaces.
Returns:
... |
code_exercise_27k | 1,454 | Write a Python function named `reverse_words` that takes a string as input and returns a new string where the order of the words is reversed. Assume that words are separated by spaces and there are no punctuation marks. The function should handle edge cases such as an empty string or a string with only one word.
The c... | Here is the Python code to solve the given problem in the markdown block:
```python
def reverse_words(input_string: str) -> str:
"""
Reverses the order of words in a given string.
Args:
input_string (str): The input string containing words separated by spaces.
Returns:
str: A new strin... |
code_exercise_27k | 1,455 | Write a Python function named `is_palindrome` that takes a string as input and returns `True` if the string is a palindrome, and `False` otherwise. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, ignoring spaces, punctuation marks, and case sensitivity.
... | Here is the Python code to solve the given problem in the markdown block:
```python
import re
def is_palindrome(input_string: str) -> bool:
"""
Determines if the given string is a palindrome.
A palindrome is a string that reads the same forward and backward, ignoring spaces, punctuation marks, and case se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.