Learn to code! We’ve developed the following lesson plan to provide you with a flavour of the power of coding in an accessible and engaging way.

**Introduction to Programming**

– Introduction to the concept of programming and getting to know the environment

– Use of command prompt to make simple calculations with numbers first and then variables

– Write simple functions to implement physics formulas, like kinetic energy and force

– Introduction of the “if structure” by wrong input examples, such as negative mass and negative time values

– Extension to the more complex “if structure” including “elseif” to implement more than 2 options that are always mutually exclusive, that is, always only one is satisfied

– Introduction of matrices in octave: call the simple functions for a range of numbers, eg. Call the kinetic energy function for 1000 velocity values

– Introduction of the “for loop”

– Simple algorithms using the “for loop” to calculate the minimum, the maximum and the average of an one-dimensional matrix

– Extend to two-dimensional matrices

– Introduction to the concept of a counter that counts for example the zeros in a a matrix

– Algorithm to fill diagonal matrix, to check if a matrix is diagonal and symmetrical (use of logical flags)

**Practical part (60 points)**

- Write a function that takes as input the mass and the velocity of a moving object and calculates its kinetic energy (do not check for negative mass) (7 points)
- Write a script to call the above function for two different objects, that is, two different masses, and velocities ranging from 1 to 1000 (10 points)
- Plot the kinetic energy across the velocity for both objects on the same figure (3 points)
- Write a function that:
- asks the user of the number of rows and columns (the same number for rows and columns, so just one number) (3 points)
- checks if the number is positive. If yes, it continues with parts c, d and e. If not, it prints an error message (3 points)

- Creates a random matrix with the dimensions given at part a. (2 points)
- Calculates the average of the matrix elements that are on the diagonal (10 points)
- Prints the result in the command window in a user-friendly message (2 points)

- Write a function that takes as input an one-dimensional matrix and
- Calculates the maximum value in the matrix (8 points)
- Calculates the position of the maximum value (7 points)
- Prints the maximum value and its position in the command window in a user-friendly message (5 points)

**Useful Links**

*Provides bite-size coding hints and tips*

University of Cambridge’s OER4Schools Professional Learning Resource

*Provides comprehensive online coding education videos in African communities*

**SRA Coding-related Presentations at UNESCO Conferences**

Using mobile technology to engage African women in science and mathematics education: Outcomes of a trial with Raspberry Pi – UNESCO Mobile Learning Week, 2015

International Forum on ICT and Education 2030 – UNESCO, 2017

Above: Beneficiaries of SRA’s coding classes