Add more detailed docstring
This commit is contained in:
parent
d76c74395b
commit
98ea589c58
22
web_view.py
22
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():
|
||||
|
|
Loading…
Reference in a new issue