I figured out problem. here is my code. now it works as it should! Thank you everyone!
def speed():
infile = open('speed.in', 'r')
line = infile.readline()
read = int(line)
while '-1' not in line:
i = 0
t0 = 0
v = 0
if len(line.split())==1:
read = int(line)
while i<read:
line = infile.readline()
list1 = line.split()
s = int(list1[0])
t1 = int(list1[1])
t = t1- t0
v += s*t
i+=1
t0 = t1
print v
line = infile.readline()
infile.close()
speed()
--
http://mail.python.org/mailman/listinfo/python-list
