Hi,
The following code (thanks Wolfgang!) allows me to write a Python program
while preserving indentation. However, this code stops working if I use
\hskip starting from line P=0.
Thank you for your help.
Fabrice
\defineframedtext
[algorithmframe]
[width=fit,
foregroundstyle={\tt\switchtobodyfont[11pt]},
framecolor=,
rulethickness=,
location=middle,
after=,
before=,
]
\startlinecorrection[blank]
\startmidaligned
\algorithmframe{
from math import comb
\hskip 1ex def binomiale(i,n,p):
\hskip 4ex return comb(n,i) * p**i * (1-p)**(n-i)
\hskip 1ex def proba(k):
P = 0
for i in range(0,k+1):
P=P+binomiale(i,20,0.5)
return P
}
\stopmidaligned
\stoplinecorrection
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________