The trinket.io platform allows us to run Python code inside a web browser on any device.
This system works immediately without the need to install any programming environment.
Any created program can be shared or embedded in another web page, simply and quickly.
You can work with Python very easily, even from your phone!
We write the Python code in the text editor on the left, then press the Run button in the menu at the top.
The result will be displayed on the right. Each time the program is run, the results window will be overwritten.
(In case of an error, an appropriate message will appear.)
To simulate running in the Python console, use the Console command from the menu (click on the downward-facing arrow).
The application menu contains useful options such as Reset (resets the program to its initial state), Fullscreen (displays
the editor in full screen), Font size (sets the font size of the editor), etc.
We can share our program or create a link to it using the Share command in the menu.
Note: This system is implemented using the JavaScript programming language, so not all functionalities
of a Python IDE are available, it is purely for educational purposes.
Functions can be grouped into modules, which are separate files with the extension *.py,
which we can include in the program. The list of standard modules available
for this system is found in the main menu, section Modules.
Examples: math, random, numpy, turtle, etc.
To include a module in the program, we use the import directive, followed by the name of the library:
import random
We can include multiple modules in a single command, for example:
import random, math
The Python language is extensible through new modules that users around the world can create and possibly distribute.
A module can contain functions, variables, classes, and even executable code, but in a program, it can be included only once using the import directive.
To create a new module, press the + button which will open a new file associated with our project. Enter the desired name, then the ".py" extension and write
the desired functions inside it. Don't forget to import it into the main program and call the functions appropriately
(module_name.function_name)!