March 11, 2020 at 12:00 am
Comments posted to this topic are about the item Capitalize the name
March 11, 2020 at 5:47 am
Nice question, thanks Steve
Learned something today...
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
βlibera tute vulgaris exβ
March 11, 2020 at 7:33 am
Good question! Can we expect one for proper next? π
March 11, 2020 at 9:39 am
How about:
name.title();
Wouldn't that work for this one-word example?
You never know: reading my book: "All about your computer" might just tell you something you never knew!
lulu.com/kaspencer
March 11, 2020 at 3:29 pm
Good question! Can we expect one for proper next? π
Perhaps you want to write one π
March 11, 2020 at 3:31 pm
Well, technically speaking none of the answers is correct, because the variable is named
Usernamewhich by the way violates PEP8 π
Apologies for that. I think the PEP8 violation is the least of my problems with a variable called "Username" (originally) and answers with name.xx(). Both corrected.
March 12, 2020 at 3:09 am
How about:
name.title();Wouldn't that work for this one-word example?
# Python v2.7.13 code:
str = "this is string example.";
print str
print "str.capitalize() : ", str.capitalize()
print "str.title() : ", str.title()
$python main.py
# Results:
this is string example.
str.capitalize() : This is string example.
str.title() : This Is String Example.
March 12, 2020 at 9:49 am
Exactly, George, as per my "one word example".
You never know: reading my book: "All about your computer" might just tell you something you never knew!
lulu.com/kaspencer
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply