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 to be modified.
  • slice(), .pop(), .index(), .remove() and .insert() are some of the key functions used on mutable arrays.
  • tuples are immutable which means its contents cannot be modified.

Iterations


  • Iterations and loops are used to perform repetitive operations.
  • Implementation of for-loop involves 4 steps.
  • Conditional statements are used within loops to handle different situations.
  • while-loop is suited when exact number of conditions/iterations are 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 make repetitive tasks efficient.
  • Keyword def is used to create a function.
  • Optional arguments does not require prior definition.
  • Inter-connectivity of functions make them very powerful.