"Tuple index out of range" Error?
<p>I'm not sure what I'm doing wrong here, does anyone know? I keep getting an error that says "Tuple index out of range." I'm following a tutorial for school and I seem to be doing everything right, however I keep getting this error. Any help would be appreciated! Thank you so much.</p>

<pre><code>animal = input("Enter any LARGE animal: ")
smallAnimal = input("Enter any SMALL animal: ")
weapon = input("Enter a sharp weapon: ")

def createDictionary():

    storyDict = dict()
    storyDict['animal'] = animal
    storyDict['smallAnimal'] = smallAnimal
    storyDict['weapon'] = weapon

return storyDict

def main():

    dictionary = createDictionary()

    animalFormat = """Once upon a time, there was a very, very large {animal}. This {animal} was the meanest, baddest, most gruesome {animal} there     was. And one day, a wild {1} had
    stepped on the {animal}'s foot. At that moment, the {1} knew it had messed up. This made the {animal} angry, so he took a {weapon} and STABBED the 
    {smallAnimal}with it! The {smallAnimal} squirmed and fought to get out, but it was no match for the {animal} with a {weapon}.

    The End."""

    withSubstitutions = animalFormat.format(**dictionary)
    print(withSubstitutions)


main()
</code></pre>

<p>This error is because you have <strong>named substitution</strong> (such as <code>.. very large {animal} ..</code>) as well as <strong>positional substitution</strong> (such as <code>At that moment, the {1} knew ..</code>).</p>

<p>Consider passing something like:</p>

<pre><code>animalFormat.format("Replacement for {0}", "Replacement for {1}", **dictionary)
</code></pre>

<p>In the above case, positional portion of the substition will read:</p>

<pre><code>At the moment, the Replacement for {1} knew ..
</code></pre>

python tuples