ATTENTION

Our website is currently experiencing some technical difficulties and our team is working hard to fix them.

Rest assured you can still access our programs and resources!

# The Solutioneers Week 6: Just Keep Coding

Format
Subjects

#### Share on:

This week's episodes and hands-on activity explore Python coding.

On this episode of The Solutioneers, Riley adds a wireless link to the robot by using Python coding to make it move. Riley gives Kat a brief tutorial on Python and how it uses commands, arguments, and shows errors.

And on Future Minds, Shounak shares the app he coded to facilitate machine learning for people with Parkinson’s disease.

Code is the language of computers and robots. In this activity, play robot with a friend to create your first code. If you’re up for a challenge, you can also play with Python code, the same language Riley used!

### WHAT DO YOU NEED?

• Graph paper or the grids provided (see below)
• Set of pixel images
• Drawing materials
• A partner*

### WHAT DO YOU DO?

Choose who will be the drawing robot and who will be the programmer. You can switch on your next turn!
The programmer chooses one of the pixel images and keeps it hidden from the drawing robot.

The programmer needs to create a set of instructions that the drawing robot will use to recreate the pixel image that the programmer chose. The programmer should keep track of how many instructions were needed.

The drawing robot then tries to create the image using only the set of instructions given (e.g., colour black in E3, colour black in F3, etc.). ​​​​

Discuss with your partner how it went. Was the drawing robot able to create the image correctly? How could the programmer improve the set of instructions? Were there any instructions that were not clear? Could you give fewer instructions?

Repeat the activity with a new image and switch roles. This time, try to reduce the total number of steps needed (e.g., colour black in squares E3, F3, etc.).

You can also use the blank templates to create your own pixel images.

### WHAT’S THE POINT?

The set of instructions you have written is called an algorithm. Computers follow algorithms to do many tasks. Algorithms are written in code, which is a programming language that computers understand.  Algorithms need to provide clear instructions. They also need to include as few steps as possible. People who create computer programs always try to create the clearest and shortest algorithms. The shorter an algorithm is, the faster a computer program can run. Python is one of the most popular programming languages, but there are many other programming languages. Python is commonly used to analyze data in many fields such as artificial intelligence, but even kids can learn the basics of Python!

### WHAT ELSE?

Check out these cool careers that use chemistry

Try This!

Try this:
Ready for a challenge involving Python code?

Access this program for coding with Python. On the left side you will see a set of instructions. This is the code for the drawing program. If you click the run button in the top bar, you will see a grid appear on the right side that has 3 coloured squares (blue, yellow and red).

When you look at the code on lines 4 to 9, you will see the names of different colours followed by three numbers in brackets. These numbers represent different colours that a computer can understand. In this case, using the RGB (Red, Green, Blue) colour system.

Scroll down to see more code. Can you see the lines of code that are for the 3 coloured squares? You will see the names of the colours as well as two numbers separated by a comma. These numbers show where on the grid the colours go using grid coordinates (x,y).

But be careful, the y axis is not numbered as you might have seen in your math class. y=1 at the top! You can see this on the grid for the fox.

Click here to see the code for the fox. How many lines of code were there?

Click the stop button at the top of the page. Now it is your turn to code. Go to line 39 and hit enter. You should now see a new line 40. Choose a colour and a grid coordinate and type it in as you see on lines 37, 38 and 39. Click the run button again to see what happened.

Time for your challenge. Create an image of your choice using what you have learned. And if you want to learn more, check out this document which compares the code for Scratch, Edublocks and Python.

Partner

With over 114 hours of award-winning kids & family programming, including Kids Emmy Award®-winning series Dark Oracle, and the long-running hit series Life with Derek - alongside family movies featuring some of Canada’s best and brightest stars including Tatiana Maslany, Ellen Page and Sandra Oh, Shaftesbury’s growing slate of kids and family co-viewing programming brings fresh content to a new generation of tween and young adult viewers across all platforms.