Coding for Medics 1: Variables and Numbers

Coding for Medics 1: Variables and Numbers

In our first tutorial in a series introducing you to Python, we’ll be learning Python from the ground up. We’ll start by learning the first parts of the alphabet, grammar and syntax of Python. Our CodeMD team will help guide you through these important first steps on the journey towards proficiency in coding. Please click the link at the bottom to go to the interactive tutorial!

The two most important concepts we’ll cover are being able to use numbers and storing information.

Using numbers centres around the use of mathematical operations – you’ll soon see how these are fundamental to programming. When we talk about data and manipulating data, we’ll invariably need to manipulate numbers. Mathematical operations (such as addition and subtraction) are one of the most common building blocks for programs. Don’t worry if you’re not confident in your maths ability! Prior knowledge of basic algebra will allow you to grasp some core concepts more quickly, but they’re not that complex! Numbers are easy to grasp intuitively and manipulating them in Python will give you a feel for what it’s like to learn coding.

In this tutorial, we will learn to use Python to perform various mathematical operations like a calculator. Calculations such as “2+2” aren’t that special on their own – but becoming adept at combining lots of these simple calculations allows you to make complicated programs.
Manipulating numbers and performing mathematical operations is one thing but how do we store them? Sometimes calculations can be complicated, requiring multiple smaller steps strung together, and storing the result for later use. There are specific ways in coding to store values which then get put into computer memory.

The second fundamental concept we’ll learn is that stored values can be used for multiple purposes in your program! The term variable is used to conceptualise storing and utilising data. Variables are like a box, within which you store data that can vary, and variable names are the labels that let you find the box to use the contents inside. Storage of data allows us to properly manipulate information – a key step in the coding journey which will allow progression from using Python as a simple calculator to far more complex and interesting logic in future tutorials!

In this tutorial, we will start to become comfortable with the concept of a variable and it’s used to store information we want to keep around whilst our program runs. At the end, we will be creating our own Fluids and CURB-65 calculators – very similar to the ones available online which doctors use every day!

Please click the link below to get to the interactive tutorial! If you have never used google colabs before, please see the link here for a tutorial.

Tutorial 1 Link: Variables and Numbers

More articles on getting you up to speed in Python coming soon!