Capitalized Word Function
<p>I Am writing a function that should take a string input and return the string with every first letter of every word as a capital letter, I have achieved this to a certain degree.</p>

<p>My Code:</p>

<pre><code>string = input("Please Enter A string:")

def capitalize_words(string):
    split = string.split()

    letter1 = ''
    letter2 = ''
    letter3 = ''

    str1 = split[0]
    str2 = split[1]
    str3 = split[2]

    for i in str1:
        if i in str1[0]:
            first = i.upper()
        else:
            letter1 = letter1 + i
            string1 = (first+letter1)

    for i in str2:
        if i in str2[0]:
            first = i.upper()
        else:
            letter2 = letter2 + i
            string2 = (first+letter2)

    for i in str3:
        if i in str3[0]:
            first = i.upper()
        else:
            letter3 = letter3 + i
            string3 = (first+letter3)

    result = string1+' '+string2+' '+string3
    return result


func = capitalize_words(string)
print(func)
</code></pre>

<p>Input:</p>

<pre><code>Please Enter A string:herp derp sherp
</code></pre>

<p>Output:</p>

<pre><code>Herp Derp Sherp
</code></pre>

<p>However this is very inflexible because i can only enter 3 words with spaces no more no less , this makes for a rather primal program. I would like to be able to enter anything and get the desired result of the first letter of every word being a capital letter no matter how many words i enter.</p>

<p>I fear with my skills this is as far as I am able to get, can you please improve my program if possible.</p>
