Reputation:
I know that you can make a whole statement capital by using ".upper" but .upper() but how do you just make just the first word capital on input statement?
How would I make it in this case?
custumer_name = input(format("Enter Custumer's name: ",">27s"))
print (custumer_name)
What I would like to do is that, if I input "peter", it capitalizes the first letter "P" and then it prints it as "Peter".
Upvotes: 1
Views: 2001
Reputation: 25478
If you want just the first word capitalized, use capitalize
. If you want all words capitalized (e.g. for a name written as Firstname Surname), use title
:
>>> s = 'peter jones'
>>> s.capitalize()
'Peter jones'
>>> s.title()
'Peter Jones'
Upvotes: 3