Skip to content

Commit f96b6fd

Browse files
committed
More tweaks to interest calculator
1 parent ed6c538 commit f96b6fd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/psc/gallery/examples/interest_calculator/calculator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ def interest(*args, **kwargs):
22
# Signal that PyScript is alive by setting the ``Calculate``
33
# button away from disabled.
44
calculate_button = Element("calc") # noqa
5-
calculate_button.element.setAttribute("disabled")
5+
# calculate_button.element.setAttribute("disabled")
66

77
# Now get the various inputs
88
element_principal = Element("principal") # noqa
@@ -15,8 +15,8 @@ def interest(*args, **kwargs):
1515
output2 = Element("compound_interest") # noqa
1616
res1 = round(principal + (principal * rate * time))
1717
res2 = round(principal * ((1 + rate) ** time))
18-
output1.write("simple interest: " + str(res1))
19-
output2.write("compound interest: " + str(res2))
18+
output1.write(f"simple interest: {res1}")
19+
output2.write(f"compound interest: {res2}")
2020

2121

2222
def setup():

src/psc/gallery/examples/interest_calculator/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ <h1 id="header_h1">Welcome to the Compound Calculator!</h1>
4949

5050
<div>
5151
<label>Principal
52-
<input id="principal" type="number" style="color: black; min-height: 60px;"/></label>
52+
<input id="principal" type="number" step="1", style="color: black; min-height: 60px;"/></label>
5353
<br/><br>
5454
<label>Interest rate
55-
<input id="interest_rate" type="number" style="color: black; min-height: 60px;"
55+
<input id="interest_rate" type="number" step="0.1" style="color: black; min-height: 60px;"
5656
placeholder="Decimal, f.e. 0.8"/>
5757
</label>
5858
<br>
5959
<br/>
6060

6161
<label>Time
62-
<input id="time" type="number" style="color: black; min-height: 60px;"
62+
<input id="time" type="number" step="1" min="0" style="color: black; min-height: 60px;"
6363
placeholder="in years"/></label>
6464
<br> <br/>
6565

0 commit comments

Comments
 (0)