-
Notifications
You must be signed in to change notification settings - Fork 171
Modify incorrect definition of str.capitalize()
#1635
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
Conversation
I tested out this comment by to fix conflicts. Works perfectly and avoids use of |
@Thirumalai-Shaktivel Can you have a look at this once the CI logs run completely ? Thanks. |
This pull request is ready for review. @Shaikh-Ubaid |
val = ord(x[0]) | ||
if val >= ord('a') and val <= ord('x'): | ||
val = ord(res[0]) | ||
if val >= ord('a') and val <= ord('z'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 681: Since we already know the ord()
value for a
and z
, how about we directly use it as a constant value here? For example: if val >= 97 and val <= 122: # Check if lowercase
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using ord('a')
is more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shared a minor query above. It looks good to me. Thank you so much for this!
Thanks @Shaikh-Ubaid and @certik for the set of reviews. |
str.capitalize()
in python should not only raise the first character to UpperCase but also necessarily converts all other characters to Lowercase.Checkout master -
On branch -