fork download
  1. if c==excelfiles[1]:
  2. b ==excelfiles[1]
  3. wb = xlrd.open_workbook(a)
  4. wb.sheet_names()
  5. sh = wb.sheet_by_index(0)
  6. for rownum in range(sh.nrows):
  7. print sh.row_values(rownum)
  8.  
  9. for i in range(sheet.nrows):
  10. cashflow = [sheet.cell_value(i,0)],[sheet.cell_value(i,1)],[sheet.cell_value(i,2)]
  11. print cashflow
  12.  
  13. def npv(rate, cashflow):
  14. value = cashflow[1] * ((1 + rate/100) ** (12 - cashflow[0]))
  15. FV = 0
  16. FV += value
  17. return FV
  18.  
  19. def irr(cashflow, iterations = 100):
  20. rate = 1.0
  21.  
  22. i = 0
  23. while (cashflow[0][1] == 0):
  24. i += 1
  25.  
  26. investment = cashflow[i][1]
  27.  
  28. for i in range(1, iterations+1):
  29. rate *= (1 - (npv(rate, cashflow) / investment))
  30. return rate
  31.  
  32. r = irr(cashflow) # why is list index out of range?
  33. print r
  34.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
if c==excelfiles[1]:
^
Main.java:32: error: illegal character: \35
r = irr(cashflow) # why is list index out of range?
                  ^
2 errors
stdout
Standard output is empty