The version of Python available on your NumWorks calculator is MicroPython 1.9.4, compatible with Python 3.4.

When you enter the application, you will see the list of saved scripts. When you first use the application, three scripts are defined as examples: `factorial.py`

, `mandelbrot.py`

and `polynomial.py`

.

You can add up to 8 scripts in the list.

- Select the
**Add a script**cell at the bottom of the list. - Confirm by pressing
.*ok*

A new script appears in the list. You can then enter a name for this script.

To delete a script, select the settings icon next to the script name and press ** ok**. Choose

To change a script name, select the settings icon next to the script name and press ** ok**. Choose

To write to a script, simply select the script name and press ** ok**. The editor opens and you can write your algorithms inside.

To help you write, press ** toolbox**. A menu will open and show some shortcuts to make the editing easier. The menu

`for`

and `while`

loops, `if`

tests and a series of Automatic import is automatically enabled for your scripts. This means that the command `from script_name import *`

is systematically entered when the shell is opened so that you can use the functions you defined in the scripts inside the console.

To disable automatic import of a script, select the settings icon next to the script name and press ** ok**. Choose

At the bottom of the list of scripts is a button **Python shell** which allows access to the interactive shell of Python.

The triple arrows `>>>`

prompts you to enter a command.

You can use the shortcuts on the ** toolbox** menu to make text entry easier. You will also find in the menu of the

The modules present in this version of Python are the `math`

, `cmath`

, `random`

, `turtle`

and `kandinsky`

modules.

Here is the complete description of the `math`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`e`

The constant `e=2.718281828459045`

.

`pi`

The constant `pi=3.141592653589793`

.

`sqrt(x)`

Square root, type `sqrt(x)`

for $\sqrt{x}$.

`pow(x,y)`

Power, type `pow(x,y)`

for $x^y$.

`exp(x)`

Exponential, type `exp(x)`

for $e^x$.

`expm1(x)`

Exponential minus 1, type `expm1(x)`

for $e^x-1$.

`log(x)`

Natural logarithm: `log(x)`

calculates $ln(x)$.

`log2(x)`

Base-2 logarithm, type `log2(x)`

for $\frac{ln(x)}{ln(2)}$.

`log10(x)`

Base-10 logarithm, type `log10(x)`

for $\frac{ln(x)}{ln(10)}=log(x)$.

`cosh(x)`

Hyperbolic cosine.

`sinh(x)`

Hyperbolic sine.

`tanh(x)`

Hyperbolic tangent.

`acosh(x)`

Inverse hyperbolic cosine.

`asinh(x)`

Inverse hyperbolic sine.

`atanh(x)`

Inverse hyperbolic tangent.

`cos(x)`

Cosine in radians.

`sin(x)`

Sine in radians.

`tan(x)`

Tangent in radians.

`acos(x)`

Arc cosine.

`asin(x)`

Arc sine.

`atan(x)`

Arc tangent.

`atan2(y,x)`

Type `atan2(y,x)`

to calculate $atan(\frac{y}{x})$.

`ceil(x)`

Ceiling.

`copysign(x,y)`

Returns `x`

with the sign of `y`

, for instance `copysign(3,-1)=-3`

.

`fabs(x)`

Absolute value, `fabs(x)`

returns $\mid x\mid$.

`floor(x)`

Floor, type `floor(x)`

to calculate $\lfloor x \rfloor$.

`fmod(a,b)`

`fmod(a,b)`

returns $a$ modulo $b$.

`frexp(x)`

Mantissa and exponent of `x`

: for instance, `frexp(10)`

returns `(0.625,4)`

because $10=0.625\times2^4$.

`ldexp(x,i)`

Inverse of `frexp(x)`

, that is $x\times2^i$.

`modf(x)`

Fractional and integer parts, for instance `modf(5.1)=(0.1,5.0)`

.

`isfinite(x)`

Checks if `x`

is finite.

`isinf(x)`

Checks if `x`

is infinity.

`isnan(x)`

Checks if `x`

is `NaN`

.

`trunc(x)`

Returns `x`

truncated to an integer, for instance `trunc(6.7)=6`

.

`radians(x)`

Converts `x`

from degrees to radians, for instance `radians(180)`

returns `3.141592653589793`

.

`degrees(x)`

Converts `x`

from radians to degrees, for instance `degrees(pi)`

returns `180`

.

`erf(x)`

Error function, $erf(x) = \frac{2}{\pi}\int_0^x e^{-t^2} \, \mathrm dt$.

`erfc(x)`

Complementary error function, $erfc(x) = 1-erf(x)$.

`gamma(x)`

Gamma function.

`lgamma(x)`

Log-gamma, $lgamma(x)=ln(gamma(x))$.

Here is the complete description of the `cmath`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`e`

The constant `e=2.718281828459045`

.

`pi`

The constant `pi=3.141592653589793`

.

`phase(z)`

Phase of `z`

in radians, for instance `phase(1j)=1.570796326794897`

.

`polar(z)`

Representation of `z`

in polar coordinates: `polar(1j)`

returns `(1.0, 1.570796326794897)`

.

`rect(z)`

Representation of `z`

in cartesian coordinates: `rect(1,pi/4)`

returns `0.70710+0.70710j`

.

`exp(x)`

Exponential function, for instance `exp(i*pi/4)`

returns `0.70710+0.70710j`

.

`log(x)`

Natural logarithm, for instance `log(1j)`

returns `1.570796326794897j`

.

`sqrt(x)`

Square root.

`cos(x)`

Cosine.

`sin(x)`

Sine.

Here is the complete description of the `random`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`getrandbits(k)`

Returns an integer with `k`

random bits.

`seed(x)`

Initialize the random number generator.

`randrange(start,stop)`

Returns a random number in `range(start,stop)`

.

`randint(a,b)`

Returns an integer in `[a,b]`

.

`choice(list)`

Returns a random number in the list.

`random()`

Returns a random floating point number in `[0,1[`

.

`uniform(a,b)`

Returns a random floating point number in `[a,b]`

.

Here is the complete description of the `turtle`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`forward(x)`

Move forward by `x`

pixels.

`backward(x)`

Move backward by `x`

pixels.

`right(a)`

Turn right by `a`

degrees.

`left(a)`

Turn left by `a`

degrees.

`goto(x,y)`

Move to (`x`

,`y`

) coordinates.

`setheading(a)`

Set the orientation by `a`

degrees.

`circle(r)`

Circle of radius `r`

pixels.

`speed(x)`

Drawing speed (`x`

between 0 and 10).

`position()`

Return the current (`x`

,`y`

) location.

`heading()`

Return the current heading.

`pendown()`

Pull the pen down.

`penup()`

Pull the pen up.

`pensize(x)`

Set the line thickness to `x`

pixels.

`isdown()`

Return `True`

if the pen is down.

`reset()`

Reset the drawing.

`showturtle()`

Show the turtle.

`hideturtle()`

Hide the turtle.

`color('c')`

or `color(r,g,b)`

Set the pen color.

`blue`

Blue color.

`red`

Red color.

`green`

Green color.

`yellow`

Yellow color.

`brown`

Brown color.

`black`

Black color.

`white`

White color.

`pink`

Pink color.

`orange`

Orange color.

`purple`

Purple color.

`grey`

Grey color.

Here is the complete description of the `kandinsky`

module. You can get this list on your calculator by pressing ** toolbox** and going to

`color(r,g,b)`

Defines the color from the values of `r`

,`g`

,`b`

.

`get_pixel(x,y)`

Returns the pixel `x`

,`y`

color.

`set_pixel(x,y,color)`

Colors the pixel `x`

,`y`

of the `color`

color.

`draw_string(text,x,y)`

Displays `text`

from the pixel `x`

,`y`

.

The menu of the ** var** key lists all the functions defined in your scripts (containing no errors) as well as the global variables.

The ** toolbox** key menu contains four sections for the faster editing of your scripts.

Contains instructions for `for`

and `while`

loops as well as `if`

tests.

Contains the functions available in the `math`

, `cmath`

, `random`

and `kandinsky`

modules.

Contains the functions that can be used in Python, especially those of the modules but also functions like `print()`

and `input()`

. An alphabetical search with the letters of the keyboard is possible.

Contains instructions for defining a function: `def function(argument):`

and `return`

.

- Python
- Scripts
- The script list
- Adding and removing a script from the list
- Renaming a script
- Editing a script
- Disabling automatic import into the shell
- The shell
- Modules
- The math module
- The cmath module
- The random module
- Le module turtle
- The kandinsky module
- Toolbox and var keys
- The var key
- The Toolbox key