How does this particular parameter receive a value?
<p>I have the following script that is taken from a python game development book. The author explains everything, except for one thing. I tried to figure it out myself, but as a beginner it is not making much sense. Here is the code:</p>

<pre><code>import random
import time

def displayIntro():
    print('You are on a planet full of dragons. In front of you,')
    print('you see two caves. In one cave, the dragon os friendly')
    print('and will share his treasure with you. The other dragon')
    print('is greedy and hungry, and will eat you on sight.')
    print()

def chooseCave():
    cave=''
    while cave != '1' and cave != '2':
        print('Which cave will you go into? (1 or 2)')
        cave=input()
    return cave

def checkCave(chosenCave):
    print('You approach the cave...')
    time.sleep(2)
    print('It is dark and spooky...')
    time.sleep(2)
    print('A large dragon jumps out in front of you! He opens his jaws and...')
    print()
    time.sleep(3)
    friendlyCave=random.randint(1,2)
    if chosenCave==str(friendlyCave):
        print('Gives you his treasure!')
    else:
        print('Gobbles you down in one bite.')

playAgain='yes'
while playAgain=='yes' or playAgain=='y':
    displayIntro()
    caveNumber=chooseCave()
    checkCave(caveNumber)
    print('Do you want to play again? (yes or no)')
    playAgain=input()
</code></pre>

<p>Now my question is this: how does the parameter <code>chosenCave</code> get a value? To me it seems that it wasn't defined anywhere. We defined what <code>cave</code> is and what <code>friendlyCave</code> is, but not <code>chosenCave</code>. What is happening here? What am I missing? </p>

<p>Sorry if this is a complete beginner question. </p>
