mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-09-28 13:33:11 +08:00
Simplify implementation (#14654)
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 4 to 5. - [Release notes](https://github.com/actions/upload-pages-artifact/releases) - [Commits](https://github.com/actions/upload-pages-artifact/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/upload-pages-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
parent
b995597167
commit
185ef19b17
@@ -13,12 +13,11 @@ def capitalize(sentence: str) -> str:
|
||||
>>> capitalize("")
|
||||
''
|
||||
"""
|
||||
if not sentence:
|
||||
return ""
|
||||
|
||||
# Capitalize the first character if it's a lowercase letter
|
||||
# Concatenate the capitalized character with the rest of the string
|
||||
return sentence[0].upper() + sentence[1:]
|
||||
# Slicing keeps this safe for empty strings.
|
||||
return sentence[:1].upper() + sentence[1:]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user