How to Draw a Triangle in Python Turtle

Python has a simple pen drawing library called turtle. Using simple movement commands, we can draw shapes using the python turtle library. When teaching python to children, turtle is a good library to introduce to get children excited about the language and its features. The basic actions used in the following examples are, Draw a […]

How to Calculate SHA256 Hash of a File in Python

SHA256 is a secure hash algorithm which creates a fixed length one way string from any input data. The algorithm is designed in such a way that two different input will practically never lead to the same hash value. This property can be used to verify the integrity of the data. If data and hash […]

How to Calculate Average of Numbers in Python

The average or arithmetic mean of a collection of numbers is calculated by adding the numbers and then dividing it with the number of numbers in the collection. The arithmetic mean is used in almost all scientific disciplines for analysis. Consider the collection of numbers – 5,7,8,12. The arithmetic mean is (5+7+8+12)/4 = 8. There […]

How to Find Factorial in Python

The factorial of a number n is defined as the product of all integers from 1 to the number n. For example, the factorial of number 5 is 1*2*3*4*5 = 120. Factorial of number n is represented as n!. For larger values of n, the factorial value is very high. The factorial of zero by […]

AES 256 Encryption and Decryption in Python

The following python program demonstrates how to perform AES 256 encryption and decryption using the pycrypto library. Please note that this example is written in Python 3. First ensure that pycrypto library is installed on your system by running the following command, pip3 install pycrypto In the following python 3 program, we use pycrypto classes […]