Hello Folks,
I have created different functions for the exercise problem of EMI calculation but I am not getting how
to combine these all functions to get a single function to form a dictionary …
Can you guys please help me out?
def readlines(path):
with open(path, 'r') as f:
lines = f.readlines()
return lines
def parse_values(data_line):
result = []
for item in data_line.strip().split(','):
if item == '':
result.append(0.00)
else:
result.append(float(item))
return result
def list_of_parameter(parameters): # Parameter will be number like 1, 2, 3 to get list of amount, rate of intrest, down payment etc.
lists = []
for data_line in lines[1:]:
values_in_data_line = parse_values(data_line)
lists.append(values_in_data_line[parameters])
return lists
def all_list(no_of_column):
final_list = []
for i in range(0, no_of_column):
single_list = list_of_parameter(i)
final_list.append(single_list)
return final_list
def parse_headers(header_line):
return header_line.strip().split(',')