I'm writing a program that has a function that writes to a file. Then a different function reads from the file prints the values then the min, max and avg values. When I try to read from the file I get the following error.
Traceback (most recent call last):                                                                                                                                       
  File "A8.py", line 39, in <module>                                                                                                                                     
    main()                                                                                                                                                               
  File "A8.py", line 35, in main                                                                                                                                         
    read_output('file_name.txt')                                                                                                                                         
  File "A8.py", line 19, in read_output                                                                                                                                  
    biggest = min(data)                                                                                                                                                  
ValueError: min() arg is an empty sequence
As far as I know this means that the variable getting passed to min is empty? I can't really understand why or how I should go about fixing it. Here is the rest of my code.
def write_input(file_name):
    try:
        inputfile = open('file_name.txt','w')
        while True:
            inp = raw_input("Please enter a number. Press Enter to exit")
            inputfile.write(str(inp) + '\n')
            if inp == "":
                inp = "\n"
                break
    except Exception as err:
        print(err)
def read_output(file_name):
    f = open('file_name.txt')
    for line in iter(f):
        print line
    data = [float(line.rstrip()) for line in f]
    biggest = min(data)
    smallest = max(data)
    print("Biggest" + biggest)
    print(smallest)
    print(sum(data)/len(data))
def main():
    print(" 1. Save data (which runs write_input)")
    print(" 2. Get stats (which runs read_output)")
    print(" 3. Quit")   
    x = raw_input("Please select an option")
    if x == '1':
        write_input('file_name.txt')
    if x == '2':
        read_output('file_name.txt')
    if x == '3':
        print("Goodbye")
main()
 
     
     
     
    