Q:

Unordered type error: int stored as string

I'm looping through a file to find the highest value and then return the value and number of lines. If I didn't convert myMax with int() I would get an unordered type error with the variable set as a string. What did I forget?!
def main():
    myMax= 0
    myCount = 0

    myFile = open("numbers.dat", 'r')
    for line in myFile :
        myCount = myCount + 1
        if int(line) > int(myMax): 
            myMax = line

    myFile.close()

    print ("Out of %s lines, the highest value found was %s" %(myCount, myMax))

main()  

A:

You need to change myMax = line to myMax = int(line). This will also make if int(line) > int(myMax): convertable to if int(line) > myMax:

