diff --git a/utils.py b/utils.py new file mode 100644 index 0000000000..d213120c84 --- /dev/null +++ b/utils.py @@ -0,0 +1,16 @@ +import random + +def alternating_case(input_string: str) -> str: + """ + Converts a string to alternating random case. + + :param input_string: The string to convert. + :return: The input string with each alphabetic character in a random case. + """ + result = "" + for char in input_string: + if char.isalpha(): + result += random.choice(["upper", "lower"])(char) + else: + result += char + return result \ No newline at end of file