# Anna Ritz
# Project 2 
# Skeleton Code

## This program assesses how "popular" each republican candidate is
## by counting the number of [applause] tags in a
## Republican debate.

# CONSTANT VARIABLES (will NEVER change values) are in ALL CAPS
# If you put these variables OUTSIDE all functions, then you
# can access them in ANY function.
CANDIDATES = ['GINGRICH','PAUL','ROMNEY','SANTORUM']
DEBATE_FILE = 'AZDebate.txt'

def assessPopularity():
    '''Assesses the popularity of the candidates in the AZ debate.
    INPUTS: none
    OUTPUTS: none'''

    # Step 1: Read the debate file
    myString = readFile()

    # Step 2: For each candidate, assess popularity
    for cand in CANDIDATES:
        countApplause(cand,myString)
        
    return

def readFile():
    '''Reads DEBATE_FILE and returns a string.
    INPUTS: none
    OUTPUTS: String of the debate'''

    return '' # returns an empty string for now.

def countApplause(candidate,debateString):
    '''Assesses the popularity of the candidate in the debateString.
    INPUTS: candidate (String) - name of candidate
    OUTPUTS: none'''

    # Make a list that splits the debate string on a newline.
    myList = debateString.split()

    # Initialize an applause counter.
    applause = 0
    
    # For each line, determine whether the candidate spoke the line.
    # If they spoke the line, then search for the tag [applause]
    for line in myList:
        print 'test if candidate spoke line'
        # if candidate spoke the line:
            # Count the number of [applause] tags and increment 'applause' var.
    
            
    print 'Candidate',candidate,'had applause',applause,'times.'
    
    return 
    
