Arrays and Matrices in Python

This tutorial gives introduction about arrays and matrices in Python, provided by the Numpy module.

1  Array

1.1  Initialization of arrays

Arrays are initialized from lists or tuples using the numpy.array() function. Two dimentional arrays are initialized using list of lists, or tuples of lists, or list of tuples, etc. Higher dimensional arrays can be initialized by further nesting lists or tuples. Read more Arrays and Matrices in Python

Shallow and deep copies in Python

This tutorial describes the differences between shallow and deep copies in Python.

The difference between shallow and deep copying is only relevant for compound objects, i.e. objects containing other objects, like lists or class instances. Python creates real copies only if it has to, i.e. if the user, the programmer, explicitly demands it.  Read more Shallow and deep copies in Python

A Quick Tutorial on Python 3

After learning this quick tutorial on Python 3, you will accummulate confidence in writting your own Python codes.

1  Short Introduction

1.1  Numbers

  • /‘ always returns a float; ‘//‘ does floor division and returns an integer; ‘%‘ calculates the remainder; power calculation is done by ‘**
  • In interactive mode, the last printed expression is assigned to a special variable ‘_‘ (underscore), similar as ‘ans‘ in Matlab.

    The ‘_’ variable shall be treated as read-only. Assigning a value to it will invalidate its embedded magic behavior.

Read more A Quick Tutorial on Python 3

Memory management of variables in Python

This tutorial illustrates memory management of variables in Python.

1  Variables in C

When you do an assignment like the following in C, it actually creates a block of memory space so that it can hold the value for that variable

You can think of it as putting the value assigned in a box with the variable name as shown below Read more Memory management of variables in Python

Eclipse as IDE for Python Programming

In this tutorial, a step-by-step instruction is presented about how to use Eclipse as IDE for Python programming, through PyDev, the specific plugin for Python language.

Background

Eclipse is an open source Integrated Development Environment (IDE). As with Microsoft’s Visual Studio product, Eclipse is programming language-agnostic and supports any language having a suitable plugin for the IDE platform. The Eclipse’s plugin for Python language is PyDev.

Read more Eclipse as IDE for Python Programming