Introduction to Sorting and Sorting Algorithm

*Bold items indicate importance

Hello guys and girls!

Today I will introduce to an important topic in Computer Science and that is Sorting, I will try to explain as easy as I can for user understanding. We will also be explaining 2 related algorithms that make our work more easier but be aware that I’ve written the Algorithm code in Python 3.3 so be sure to have a Python understanding. So first lets see what Sorting is?

What is Sorting?

Lets take an example of a List of Names:

names = ['Deque', 'bluedog.tar.gz', 'Arkphaze', 'Hackcommunity', 'noize', 'Linuxephus']

Now you can see that each name has a different length and can be arranged by either placing them from Short Length to Long Length

Continue reading “Introduction to Sorting and Sorting Algorithm”

Small Network Scanner [Python]

I though that instead of using others made tools to find out hosts which are online in a given IP range, I should rather make my own with python.

UPDATED: Updated the script, it no longer takes ip as an input, Instead get the IP and starts scanning the in the possible given range it self. You need to download the Ping.py file from the github repo to be able to run the script.

The project is now hosted on Github so here’s the link: https://github.com/Ex094/Local-Network-Scanner

Intro to Python Strings

In python strings are represented by enclosing them between

1) Single Quote ‘ ‘
2) Double Quote ” “
3) Triple  Quote ”’ ”’

For example:

‘WordPress’, “Procurity”  

Those two are basically python strings. We will discuss Triple Quote in later lessons as they are used mainly for description.

In this tutorial we will discuss:

1) String Indexing

2) Slicing Strings

3) String Concantation

4) String Formatting

Continue reading “Intro to Python Strings”

Reading and Writing Files in Python – PyStarter

Python comes built-in with many functions, some of those functions allow us to read a file and write to a file. The step involved in reading a file is to open it and afterwards read it’s contents,  then either store it in a variable or print it directly.

To open a file in python we use the function open() , The syntax for open function is:

file object = open(file_name [, access_mode][, buffering])

Let me explain the parameters:

1) file_name is the name/location of the file that you want to open

2) access_mode is the way how you want the file either open it in read mode only or write mode only or even both.

Continue reading “Reading and Writing Files in Python – PyStarter”

Introduction to Range() Function in Python – PyStarters

In this tutorial we will be learning the usage of the Range() function in Python. Sometimes we require to generate a list of numbers for a particular work.

For example, you require a list of numbers from 1 to 15 so that from them you can pick out the numbers divisible by 5 only. For that we use the Range function, the syntax of range function is:

range(start, end)

Simple as that, So for our program it would be like:

range(1, 15)

Continue reading “Introduction to Range() Function in Python – PyStarters”

Conditional Statements in Python – PyStarter

In programming, most of the time we come across a stiff situation where we are required to do one or more task depending on the output of the first most task. Lets take an example of a simple program which give the output a set of even numbers between 1 to 20.

Now we want this program to only view all the even numbers only but first lets see what conditionals are and how many types are there in Python. Well  In Python there are 3 Basic Conditionals statements:

1) If Condition
2) Else If Condition
3) Else Condition

Here’s a little diagram to demonstrate how the conditional statements work:

Conditional Statement Working Schematic

Continue reading “Conditional Statements in Python – PyStarter”

Error Handling and Exception In Python

While making programs, one thing a programmer must keep in mind is how to handle unexpected errors. Errors can some time be very frustrating and must be handled in a correct way so that the user understands what caused this error and why? In python there’s an easy way to do it. 

To understand error exception, we will make use of a sample program, the program asks the user to input his/her age so here’s the code:


Continue reading “Error Handling and Exception In Python”