Python Assignment Operators Example
Example: !/usr/bin/python a = 21 b = 10 c = 0 c = a + b print “Line 1 – Value of c is “, c c += a print “Line 2 – Value of c is “, c c *= a print “Line 3 – Value of c is “, c c /= a … Read more
Example: !/usr/bin/python a = 21 b = 10 c = 0 c = a + b print “Line 1 – Value of c is “, c c += a print “Line 2 – Value of c is “, c c *= a print “Line 3 – Value of c is “, c c /= a … Read more
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
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
A sample Program #!/usr/bin/python print “Hello, Python!”; Outupt: Executing the program…. $python2.7 main.py Hello, Python! What is Python? Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). Python … Read more