Code Club – Trinket and python Modules

Trinket allows you to use a number of different modules to add functionality to your programs.

Code Club have added a py5 module for their own projects. So this post will examine how to add one of the available libraries to your program.

Firstly a list of the modules that Trinket.io provides can be found here. along with some documentation for each.

So to add a module we need to use the import command.

Start with a blank new Python 3 project and enter the following

#!/usr/bin/env python3 #use python 3

Then the instruction to import the required module.

import numpy

Now test if you don't get errors proceed to add

from numpy import *

And test again.

Should give no errors, in which case you can now start to use module numpy

Other info

You can use modules such as Numpy and matplotlib in software such as Jupyter Notebook

Tags

#Python,#Trinket,#Modules,#HowTo,#CodeClub


MastodonPeertubeQoto sign up

#LookingForWork

Donate using Liberapay