def investment_analysis(discount_rate, cashflows):
    """Provides summary investment analysis on a list of cashflows
       and a discount_rate.
       
       Assumes that the first element of the list (i.e. at period 0) 
       is the initial investment with a negative float value.
    """
    _npv = npv(discount_rate, cashflows)
    ts = [('year', 'cashflow')] + [(str(x), format(y)) for (x,y) in zip(
           range(len(cashflows)), cashflows)]
    print "-" * 70
    for y,c in ts:
        print y + (len(c) - len(y) + 1)*' ',
    print
    for y,c in ts:
        print c + ' ',
    print
    print
    print "Discount Rate: %.1f%%" % (discount_rate * 100)
    print
    print "Payback: %.2f years" % payback(cashflows)
    print "    IRR: %.2f%%" % (irr(cashflows) * 100)
    print "    NPV: %s" % format(_npv)
    print 
    print "==> %s investment of %s" % (
        ("Approve" if _npv > 0 else "Do Not Approve"), format(-cashflows[0]))
    print "-" * 70
Provides summary investment analysis on a list of cashflows
       and a discount_rate.
       
       Assumes that the first element of the list (i.e. at period 0) 
       is the initial investment with a negative float value.
    
recipes/Python/576686_NPV__IRR__Payback_Analysis/recipe-576686.py