NAO Tips Vol. 2

Tip 3: What is Python code? 

When working with Nao in Chorégraphe it is great to remember that every base Box is made of Python Code that you can read and edit. You can also create your own Python box using the Python template in the standard box library.  Python is a specially designed programming language for teaching and learning. If you have learnt another programming language the hard way it is abundantly clear that Python is a wonderful language. Conventional programming languages tend to yell at you for the simplest of mistakes and the error messages are painfully hard to translate. Python on the other hand, is kind. If you have an error Python will tell you exactly what you did wrong and often how to fix it. As the boxes in Chorégraphe are made of python code it supports an incremental approach to learning programming. You can create your own code that to do something simple, then connect that to other boxes in Choregraphe to make some very interesting things happen. For example, the code to tell if a number is odd or even is shown below. This code allows an exercise app in Chorégraphe to alternate arms as it counts the reps.

If you would like to know more about programming in Python a good place to start is the Python documentation: Here you will find every command available in Python. In the next issue we will be doing a deep dive into writing your own python module to get Nao to say the day of the week.