Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Lanujan_solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import csv

def interest(year0, year1, year1add):

return ((((year1 - year1add)) / year0) - 1)

if __name__ == "__main__":
list1 = []
year0 = 0
year1 = 0
year1add = 0

with open("test.csv") as csvfile:
spamreader = csv.reader(csvfile)

for row in spamreader:
if row[0] == "year":
pass
else:
list1.append(row)

for i in list1:
if i[0] == "0":
year0 = float(i[2])

if i[0] == "1":
year1 = float(i[2])
year1add = float(i[1])

print interest(year0, year1, year1add)