Skip to content

Modified comments on lower.py #10369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions strings/lower.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def lower(word: str) -> str:
'what'
"""

# converting to ascii value int value and checking to see if char is a capital
# letter if it is a capital letter it is getting shift by 32 which makes it a lower
# case letter
# Converting to ASCII value, obtaining the integer representation
# and checking to see if the character is a capital letter.
# If it is a capital letter, it is shifted by 32, making it a lowercase letter.
return "".join(chr(ord(char) + 32) if "A" <= char <= "Z" else char for char in word)


Expand Down