'''
Created on Sep 14, 2017

@author: YOUR NAME HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'''
import urllib2
import random

def fileToList(url):
    '''
    This function reads a file from a given url 
    returns a list of strings where each string 
    represents one line from the file
    '''
    print "FIX: NEED TO PUT STRINGS IN CORRECT FORMAT in fileToList"
    alist = []
    source = urllib2.urlopen(url)
    for line in source:
        items = line.strip()
        alist.append(items)
    return alist       

def numberOfType(alist, someType):
    print "FIX: NEED TO WRITE numberOfType Function"
    return 0

def printQuakes(alist, num):
    print "FIX: NEED TO WRITE printQuakes to specification"
    for item in alist:
        print item

if __name__ == '__main__':
    '''
    Starting part of the earthquake program
    Read a file of earthquake data and answer
    several queries about the data.
    '''
    urlstart = "http://www.cs.duke.edu/courses/compsci101/fall17/data/"
    
    #datafile = "earthqDataAug14-Sep13-2017.txt"
    datafile = "earthqDataSmallSep2017.txt"
    eqList = fileToList(urlstart+datafile)
    
    print "Information about Earthquakes from the 30 days"
    print "leading up to September 13, 2017."
    print 
       
    print "Number of lines in the file is:", len(eqList)
    print
    numEarthquakes = numberOfType(eqList, "earthquake")
    print "Number of lines categorized as earthquakes in the file is: ", numEarthquakes
    print
    print "First ten lines in the file:"
    printQuakes(eqList, 10)
    print

