File tree 2 files changed +6
-6
lines changed
src/psc/gallery/examples/interest_calculator 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ def interest(*args, **kwargs):
2
2
# Signal that PyScript is alive by setting the ``Calculate``
3
3
# button away from disabled.
4
4
calculate_button = Element ("calc" ) # noqa
5
- calculate_button .element .setAttribute ("disabled" )
5
+ # calculate_button.element.setAttribute("disabled")
6
6
7
7
# Now get the various inputs
8
8
element_principal = Element ("principal" ) # noqa
@@ -15,8 +15,8 @@ def interest(*args, **kwargs):
15
15
output2 = Element ("compound_interest" ) # noqa
16
16
res1 = round (principal + (principal * rate * time ))
17
17
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 } " )
20
20
21
21
22
22
def setup ():
Original file line number Diff line number Diff line change @@ -49,17 +49,17 @@ <h1 id="header_h1">Welcome to the Compound Calculator!</h1>
49
49
50
50
< div >
51
51
< 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 >
53
53
< br /> < br >
54
54
< 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; "
56
56
placeholder ="Decimal, f.e. 0.8 "/>
57
57
</ label >
58
58
< br >
59
59
< br />
60
60
61
61
< 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; "
63
63
placeholder ="in years "/> </ label >
64
64
< br > < br />
65
65
You can’t perform that action at this time.
0 commit comments