I am creating a program that reads a file and if the first line of the file is not blank, it reads the next four lines. Calculations are performed on those lines and then t
readings = (infile.readline())
print readings
while readings != 0:
global count
readings = int(readings)
There's a problem with that code. readings
is a new line read from the file - it's a string. Therefore you should not compare it to 0. Further, you can't just convert it to an integer unless you're sure it's indeed one. For example, empty lines will produce errors here (as you've surely found out).
And why do you need the global count? That's most certainly bad design in Python.