Using draw_rect & Ion Funcions. Paint a Shape. You may not be able to save the script with the app. 🌲🌲🌲🌲🌲🌲🌲🐄🐄 if you want to save your scripts that you have to go to the Numworks calculator Workshop site. 💡Bonus: Try my new Level and Sprite Maker! https://my.numworks.com/python/wperez274/level_sprite_maker_18 Python The version of Python available on your NumWorks calculator is MicroPython 1.12, compatible with Python 3.4. Scripts The script list When you enter the application, you can see the list of saved scripts. When you first use the application, four scripts are defined as examples: squares.py, parabola.py, mandelbrot.py and polynomial.py. Adding and removing a script from the list You can add up to 8 scripts on the list. Select the Add a script cell at the bottom of the list. Confirm by pressing . A new script appears on the list. You can then enter a name for your new script. To delete a script, select the settings icon next to the script name and press . Choose Delete script and press . Renaming a script To change a script name, select the settings icon next to the script name and press . Choose Rename script and press to confirm. You can now change the name of the script. Editing a script To write to a script, simply select the script name and press . The editor opens and you can write your code inside. To help you write, press . A menu will open with some shortcuts to make editing easier. The menu Loops and Tests offers pre-filled blocks for for and while loops, if tests and a series of conditions. The menu Catalog lists the functions present in Python and gives a short description of them. You can also use the key to display the list of functions defined in your scripts as well as the global variables. If you want to copy and paste part of a text, select the characters to be copied by holding down the key and using or . Then press and then to copy the selection. Press and then to paste it. Autocompletion The script editor has an autocompletion feature. When you begin typing, the app will make a suggestion in gray. To accept the suggestion, press the or key. To decline the suggestion, press or just continue typing. To get a new suggestion, press the or key. All possible suggestions from the prefix you entered are listed in the menu of the key. Disabling automatic import into the shell 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 . Choose Auto import in shell and press to toggle the switch. The switch turns grey and the script will no longer be activated automatically. Modules The modules present in this version of Python are: math, cmath, matplotlib.pyplot, random, turtle, ion, time and kandinsky modules. The math module Here is the complete description of the math module. You can get this list on your calculator by pressing and going to Modules then math. e The constant e=2.718281828459045. pi The constant pi=3.141592653589793. sqrt(x) Square root, type sqrt(x) for �x. pow(x,y) Power, type pow(x,y) for ��xy. exp(x) Exponential, type exp(x) for ��ex. expm1(x) Exponential minus 1, type expm1(x) for ��−1ex−1. log(x) Natural logarithm: log(x) calculates ��(�)ln(x). log2(x) Base-2 logarithm, type log2(x) for ��(�)��(2)ln(2)ln(x). log10(x) Base-10 logarithm, type log10(x) for ��(�)��(10)=���(�)ln(10)ln(x)=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(xy). 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 ∣�∣∣x∣. floor(x) Floor, type floor(x) to calculate ⌊�⌋⌊x⌋. 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×2410=0.625×24. ldexp(x,i) Inverse of frexp(x), that is �×2�x×2i. 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 infinite. 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, ���(�)=2�∫0��−�2 d�erf(x)=π2∫0xe−t2dt. erfc(x) Complementary error function, ����(�)=1−���(�)erfc(x)=1−erf(x). gamma(x) Gamma function. lgamma(x) Log-gamma, ������(�)=��(�����(�))lgamma(x)=ln(gamma(x)). The cmath module This is the complete description of the cmath module. You can get this list on your calculator by pressing and going to Modules then cmath. 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. plot(x,y) Plots the y list versus the x list. The (x,y) points are connected by segments. If only one y list is given, the x is assumed to be [0,1,2,3...]. The color argument is optional. It allows you to choose the color of the line. scatter(x,y) Plots a scatterplot based on (x,y) values. The arguments of the function can be numbers or lists of the same length. It is possible to place an optional argument to choose the color of the line by writing: color="red". show() Draws the figure. text(x,y,"text") Displays the text set as an argument at the (x,y) coordinates. The turtle module This is the complete description of the turtle module. You can get this list on your calculator by pressing and going to Modules then turtle. 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. write("text") Writes the text placed as an argument at the position of the turtle. 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. colormode(x) colormode(1.0) changes the color mode to 1.0 and the colors must be defined by tuples of type (0.5,1.0,0.5) while colormode(255) changes the color mode to 255 and the colors are then defined by tuples of type (128,255,128). By default the color mode is 255. The random module This is the complete description of the random module. You can get this list on your calculator by pressing and going to Modules then random. 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]. The kandinsky module This is the complete description of the kandinsky module. You can get this list on your calculator by pressing and going to Modules then kandinsky. color(r,g,b) Defines the color from the values of r,g,b. You can also simply use a tuple to define a color: (r,g,b). get_pixel(x,y) Returns the pixel x,y color as a tuple (r,g,b). set_pixel(x,y,color) Colors the pixel x,y of the color color. draw_string(text,x,y,[color1],[color2]) Displays text from the pixel x,y. The arguments color1 (text color) and color2 (background color) are optional. fill_rect(x,y,width,height,color) Fills a rectangle at pixel (x,y) with the color color. The ion module This is the description of the ion module. You can get this list on your calculator by pressing and going to Modules then ion. keydown(k) Returns True if the k key in argument is pressed and False otherwise. The other items in this menu indicate the syntax used to identify the keys on the keyboard. The time module Here is the description of the time module. You can get this list on your calculator by pressing and going to Modules then time. monotonic() Returns the value of the clock at the time the function is called. sleep(t) Pauses execution for t seconds. Toolbox and var keys The var key In the script editor, the menu of the key lists the autocompletion suggestions available. In the execution console, the menu of the key lists all the functions defined in your imported scripts (not containing any error) as well as the global variables. The Toolbox key The key menu contains four sections for faster editing of your scripts. Loops and tests Contains instructions for for and while loops as well as if tests. Modules Contains the functions available in the math, cmath, random, matplotlib.pyplot, ion, time, turtle and kandinsky modules. Catalog 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. Functions Contains instructions for defining a function: def function(argument): and return.