From 98ea589c58c3b99bd25ea37d1e187024776cddd6 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Wed, 6 Dec 2023 20:57:24 +0000 Subject: [PATCH] Add more detailed docstring --- web_view.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/web_view.py b/web_view.py index f15d95f..f72aff1 100755 --- a/web_view.py +++ b/web_view.py @@ -132,7 +132,27 @@ def index() -> str | Response: def case_flip(s: str) -> str: - """Switch case of character.""" + """ + Switch the case of a single character. + + If the character is lowercase, it is converted to uppercase. If it is uppercase, + it is converted to lowercase. Non-alphabetic characters remain unchanged. + + Args: + s (str): A single character string. + + Returns: + str: The character with its case flipped, or the original character if it's + not a letter. + + Example: + >>> case_flip('a') + 'A' + >>> case_flip('A') + 'a' + >>> case_flip('1') + '1' + """ if s.islower(): return s.upper() if s.isupper():