Programming
This module will introduce you to programming using R, Python or Matlab, popular languages used in scientific computing. There are many code libraries built on top of R, Python and Matlab, allowing you to extend its functionality for a wide range of purposes. The skills you develop in this module will also be relevant in any other programming languages you may use in future.
Learning Outcomes
- Understand and use basic control structures in R, Python or Matlab
- Create simple R, Python or Matlab programs using named variables and control structures
- Debug and create tests for basic R, Python or Matlab programs.
- Understand why testing is used in software development. Write unit tests for functions.
Lessons
Getting Started With R
Getting started with R. Assigning values to variables, control structures and storing data.
- Activity: Getting Started
- Activity: Loading and Manipulating Data
- Activity: Creating Functions
- Activity: Analysing Data from Multiple Data Sets
- Activity: Making Choices
- Activity: Best practices R
Getting Started With Python
Getting started with Python. Assigning values to variables, control structures and storing data.
- Activity: Getting Started
- Activity: Loading and Manipulating Data
- Activity: Repeating Actions with Loops
- Activity: Storing Multiple Values in Lists
- Activity: Making Choices
- Activity: Creating Functions
- Activity: Defensive Programming
Getting Started With Matlab
Getting started with Matlab. Assigning values to variables, control structures and storing data.
- Activity: Getting Started
- Activity: Loading and Manipulating Data
- Activity: Writing Matlab Scripts
- Activity: Repeating With Loops
- Activity: Making Choices
- Activity: Creating Functions
- Activity: Defensive Programming
Badges
-
Conditionals
Call Me Maybe
Use a conditional statement to run different code based on a given value.
View Lesson -
Loops
Groundhog Day
Use a loop to find a cumulative or summative result in Python.
View Lesson -
Functions
Composer
Using Python, write a script which uses a function to improve the code structure and clarity.
View Lesson -
Input and Output
Input Output
Using Python, write a script to ask the user for a file to process, then save the program’s output to another file.
View Lesson -
Defensive Programming
Defender
Given a simple function, refactor the code to increase function stability by addressing edge cases and faulty or incorrect input.
View Lesson -
Test-Driven Development
The Stig
Use the Test Driven Development process of “red, green, refactor” to design, test and implement a function.
View Lesson -
Error Handling
Safety Net
Increase the stability of a piece of code by catching and handling common errors, then providing user feedback rather than exiting.
View Lesson