Python Comparison Operators Example

Comparison operators

These operators compare the values on either sides of them and decide the relation among them. They are also called Relational operators. Example: #!/usr/bin/python a = 21 b = 10 c = 0 if ( a == b ):    print “Line 1 – a is equal to b” else:    print “Line 1 – … Read more

Python Operator

python tutorial

Operators are the constructs which can manipulate the value of operands. Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called operator. Types of Operator Python language supports the following types of operators. Python Arithmetic Operators Assume variable a holds 10 and variable b holds 20, … Read more

Python Variables and Data type

python tutorial

Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you … Read more

Python Basic Syntax

python tutorial

Python is a very simple language, and has a very straightforward syntax. It encourages programmers to program without boilerplate (prepared) code. The simplest directive in Python is the “print” directive – it simply prints out a line (and also includes a newline, unlike in C). There are two major Python versions, Python 2 and Python … Read more

python : system environment variable set in windows

python tutorial

How to set system environment variable in windows? Go to the below location. My Computer > Properties > Advanced System Settings > Environment Variables > Then under system variables I create a new Variable called PythonPath. Just append your installation path (ex. C:Python27) to the PATH variable in System variables. Then close and open your command line and type ‘python’ .