Coding with Trinket and Blocks

At Paignton virtual Code Club, we are now approaching the end of the Scratch modules. Well done to everyone. The next step is probably to progress to Python [2][3].

If you don't feel ready to do lots of typing, you may want to look at Trinket and blocks. Then perhaps move to the Code Club modules [3].

Blocks, as the name suggests, is a block based system. The difference here is, that the blocks are all Python statements and code. So combining these allow you to easily start coding in Python.

To get started you need to sign up for an account on the Trinket website [1]

trinket

Click you user name and select new trinket and then select blocks

select blocks

You are now presented with your development area.

dev area

You may want to change your project title to something meaningful.

change title

You can select the category of block, then simply use click / drag in similar way as you would with Scratch.

So in this example I am just going to draw a square.

draw square

As we are using turtle, you will need to change the pen up, block so that it says pen down.

change command

Adding comments to your code is important, as it helps you keep track of what the code is doing and helps with debugging also helps others understand your code.

add comment

You can also view the Python code that is produced, this can be copy / pasted to IDE so you can just run the Python code on its own.

![View Python]

https://raw.githubusercontent.com/zleap/blogmedia/master/trinket/square-python-code.png

Finally you can share your project with others.

share

Hopefully this is helpful.

Resources

1 Trinket 2 Python 3 Code Club python Modules

#codeclub,#paignton,#trinket,#python,#coding,#skills,#technology

cc-by logo

Licenced under Attribution 4.0 International (CC BY 4.0)


MastodonPeertubeQoto sign up

Donate using Liberapay