from typing import List, Dict, TextIO

def open_temperature_file(filename: str) -> TextIO:
    """Open the file named filename, read past the three-line header, and return the open file.
    
    In the example below, notice that the next line to read gives us the fourth
    line - this function should have fully read the first three lines.
    
    >>> f = open_temperature_file('temps_small.txt')
    >>> f.readline()
    '-1.0    -0.5    1.0    10.0    10.0    20.0    20.0    20.0    20.0    10.0    0.0    1.0'
    >>> f.close()
    """
    # We want to create a TextIO object to return (as in the type contract)
    # this creates a TextIO object which we can read from
    temp_file = open(filename)
    for i in range(3):
        temp_file.readline()
        
    return temp_file
    
def average_temp_march(temp_file: TextIO) -> float:
    """Return the average temperature for the month of March
    over all years in open file temp_file.
    
    You can use the sum(L) function to get the sum of all numeric
    elements in a list.
    
    Remember that the str.split() will split a string into a list
    by spaces.
    
    >>> f = open_temperature_file('temps_small.txt')
    >>> average_temp_march(f)
    1.5
    >>> f.close()
    """
    
    # for one line:
    #line = temp_file.readline()
    #temps_for_line = line.split()
    #print(temps_for_line)
    #print('March temp:', temps_for_line[2])
    
    march_temps = []
    for line in temp_file:
        temps_for_line = line.split()
        print(temps_for_line)
        print('March temp:', temps_for_line[2])   
        march_temps.append(float(temps_for_line[2]))
    print(march_temps)
    
    return sum(march_temps) / len(march_temps)
    