""" Ex. 4.4 from "A primer on..." Same as ex 4.3, but now read multiple temperature values, store in lists, a then both F and C numbers to a new file. """ F_list = [] C_list = [] with open('Fdeg.txt') as infile: for i in range(3): infile.readline() for line in infile: words = line.split() F = float(words[-1]) F_list.append(F) C = (F - 32) * 5 / 9 C_list.append(C) with open('outfile.txt','w') as outfile: for C, F in zip(F_list, C_list): outfile.write(f'{F:6.2f} {C:6.2f} \n')