Python: Initialize list and tuple values

This tutorial will show on how to give a Python list an initial value.

To initialize a ten items list with values set to 0:

Continue reading

Posted in Python | Tagged , , , | 2 Comments

Python: Make division always produce real numbers

A division of 7/3 in Python will gives a result of 2. However, this is not correct. Since Python always assume that the numbers are whole numbers, the result will be truncated from 2.5 to 2.

A work around is to write one or both of the numbers as a decimal:

Continue reading

Posted in Python | Tagged , , , | Leave a comment

Python: Put comma(s) to numbers

This script will put commas between each group of three digits number. For example, 1234567 will become 1,234,567.

Continue reading

Posted in Python | Tagged , , | Leave a comment

Python: Prime Number

This Python script will generate a list of prime number.

Continue reading

Posted in Python | Tagged , | Leave a comment

LaTeX example – creating a lecture note

This LaTeX example will create an automatic exercises numbering as well as the problems in each exercise. It is useful for creating lecture notes.

Continue reading

Posted in LaTeX | Tagged , | Leave a comment