def reading (file): nums = [] with open(file, 'r') as file: for line in file: nums.extend(map(float, line.split())) return nums