From 185ef19b173c4c976c6ccc78fe661ca851ca0b70 Mon Sep 17 00:00:00 2001 From: Milad Khoshdel Date: Thu, 24 Sep 2026 15:51:50 +0330 Subject: [PATCH] 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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- strings/capitalize.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/strings/capitalize.py b/strings/capitalize.py index 628ebffc8..32c0b1644 100644 --- a/strings/capitalize.py +++ b/strings/capitalize.py @@ -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__":