Getting started


  • Programming is an important skill which is highly applicable to bio-research and medicine.
  • Python is one of the most popular programming language for being general-purpose and high level language.
  • Python uses an interpreter for line by line code translation.

Variables, Types, and Operations


  • Two key functions for I/O operations are print() and input()
  • Three most commonly used variables such as int, float, and str.
  • Variable scope can be local or global depending where they are being used.
  • Mathematical operations follow conventional rules of precedence
  • Logical operations provide results in Boolean (True or False)

Conditional Statements


  • Python used if, elif and else as conditional statements.
  • In Python, there is an indentation rule of 4 spaces.
  • The hierarchy of conditional statement is always the same.

Introduction to Arrays


  • lists and tuples are 2 types of arrays.
  • An index is a unique reference to a specific value and Python uses a zero-based indexing system.
  • lists are mutable because their contents can be modified.
  • slice(), .pop(), .index(), .remove() and .insert() are some of the key functions used in mutable arrays.
  • tuples are immutable, which means that their contents cannot be modified.

Iterations


  • Iterations and loops are used to perform repetitive operations.
  • Implementation of for-loops involves four steps.
  • Conditional statements are used within loops to handle different situations.
  • while-loops are most suitable when an exact number of conditions/iterations is unknown.

Dictionaries


  • Dictionaries associate a set of values with a number of keys.
  • Keys are used to access the values of a dictionary.
  • Dictionaries are mutable.
  • Nested dictionaries are constructed to organise data in a hierarchical fashion.
  • Some of the useful methods to work with dictionaries are: .items(), .get()

Functions


  • Functions can help to make repetitive tasks efficient, allowing the passing of values into whole blocks of code, with a simple function call.
  • Keyword def is used to write a function.
  • Optional arguments do not require prior definition.
  • The potential interconnectivity of functions can make them very powerful.