Python cheat Sheet
Python is an interpreted, high-level, general-purpose programming language.
Full Python cheat Sheet
Basic
Hello world
print "Hello, Python!"
Variable
An integer assignment
counter = 100
A floating point
miles = 1000.0
A string
name = "John"
Multiple Assignment
a = b = c = 1
Define a list
list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]
Tuples
tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )
Operators
If the values of two operands are equal, then the condition becomes true.
(a == b) is not true.
If values of two operands are not equal, then condition becomes true.
(a != b) is true.
If values of two operands are not equal, then condition becomes true.
(a <> b) is true. This is similar to != operator.
If the value of left operand is greater than the value of right operand, then condition becomes true.
(a > b) is not true.
If the value of left operand is less than the value of right operand, then condition becomes true.
(a < b) is true.
If the value of left operand is greater than or equal to the value of right operand, then condition becomes true.
(a >= b) is not true.
If the value of left operand is less than or equal to the value of right operand, then condition becomes true.
(a <= b) is true.