# [Zope] Zope Book -> Chap 3 -> Interest Rate Example

Jamie White greatbks@truevine.net
Thu, 5 Jun 2003 09:09:31 -0400

```Here is the complete solution:

<html>
<body>  =20
<p>Your total balance (or debt) including compounded interest over
<span tal:content=3D"request/years">2</span> years is:</p>
<span tal:define=3D"principal request/principal;=20
interest_rate request/interest_rate;
periods request/periods;
years request/years">
<p><b>\$<span tal:content=3D"python:
here.calculateCompoundingInterest(
principal,
interest_rate,
periods,
years)">
1.00
</span>
</b>
</p>
</span>
</body>
</html>

-----Original Message-----
Simon Forster
Sent: Thursday, June 05, 2003 9:05 AM
To: Sylvain Th=E9nault
Cc: zope@zope.org
Subject: Re: [Zope] Zope Book -> Chap 3 -> Interest Rate Example

On Thursday, June 5, 2003, at 01:51  pm, Sylvain Th=E9nault wrote:

> <span tal:content=3D"request/form/years">2</span>

Thank you for that. That fixes one problem but then:

\$<span tal:content=3D"python: =
here.calculateCompoundingInterest(principal,
interest_rate,
periods,
years)" >1.00</span>

fails (as I would expect given your posting) but so does

<span tal:content=3D"python:=20
here.calculateCompoundingInterest(request/form/principal,
request/form/interest_rate,
request/form/periods,
request/form/years)" >1.00</span>

with error:

Error Type: NameError
Error Value: global name 'form' is not defined

while

<span tal:content=3D"python:=20
here.calculateCompoundingInterest(request/principal,
request/interest_rate,
request/periods,
request/years)" >1.00</span>

fails with error

Error Type: NameError
Error Value: global name 'principal' is not defined

Why?

Simon Forster
___________________________________________________
LDML Ltd, Office One, 16 Canham Road, London, W3 7SR, UK
Tel: +44 (0)20 8749 7766     Fax: +44 (0)70 9230 5247
___________________________________________________

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.486 / Virus Database: 284 - Release Date: 5/29/2003
=20

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.486 / Virus Database: 284 - Release Date: 5/29/2003
=20

```