Skip to content Skip to sidebar Skip to footer

Python 3.4 - Formatting String Input Into Title Format

I'm a bit of a python amateur and I'm creating an extremely basic program. I need it to format a user's input into title format like so: Input: hello Output: Hello This is what I h

Solution 1:

firstNameInput.title() you are missing parens

In [1]: s = "hello world"

In [2]:print (s.title)
Out[2]:<built-in method title of str object at 0x7fbea30830b0>

In [3]: s.title()
Out[3]: 'Hello World'

The first is a reference to the method, the second is actually calling it.

Post a Comment for "Python 3.4 - Formatting String Input Into Title Format"