Using Loop To convert Decimal to binary we check if the number is divisible by 2, if yes then we take a string and append 0 to and and if not then append 1 to it and divide the number…
Category: python
Create a Simple FTP Server and Client in Python
FTP stands for File transfer protocol, it’s used to transfer files between server and client. Here we will see how to make a simple FTP server in python and we will do some basic example tasks like listing directories of…
Python Program to find HCF and LCM
HCF is also called Greatest Common divisor (GCD).the HCF of two or more number is the largest of all the common factors. for example:if we take two numbers, 12 and 18their common divisor are 1,2,3 and 6. therefore 6 being…
Passing argument from Command-line in Python
Sometimes it’s required to use arguments passed from cli to use in our program. Its very simple to do so.. we just need to use sys module’s argv method. import sysprint(sys.argv[1])print(sys.argv[2]) Note that using sys.argv[0] will just give program.py, which is in…
How to Add / Append items to a list in Python
To add items to a list in python is a very general task that you might come across. Here we have an empty list that we are populating with 10 items using the append method. n = 10list = []for…
Python Program for Binary Search with explanation
Binary search algorithm is used to find a number in a sorted list. so, the pre condition for binary search is that the list should be sorted. If the number is found then its index is returned. This algorithm works…
Python Program to reverse a number using loop
Here is a simple program to find the reverse of an entered number. Please note that this program works for only positive integers. Source Code: x = input(“Please Enter a number to reverse: “)reverse = 0while(x): reverse = reverse…
Simple Hello World page with django 1.9 in Ubuntu / Linux Mint [Beginners] [Part – 2]
In the First part of this tutorial we created an app named helloworld and added it to the setting.py file. Now let’s continue further towads our journey to make a ‘Hello World’ page with django. Urls Let’s define our url…
Simple Hello World page with django 1.9 in Ubuntu / Linux Mint [Beginners] [Part – 1]
Django is a web framework written in python. It is good for fast web application development. In this tutorial we will learn how to make a simple web page showing “Hello World” using django templates. we will also be applying…
Run Python SimpleHttpServer on Amazon AWS EC2
With Python’s SimpleHTTPServer you can quickly setup a webserver without any hassle. In order to use it, you don’t need to install or configure anything.. you just need to have python installed on your server. Step 1: Open up your…