Kernel: Python 3
Operators
Binary
Unary
Priorities
Binding
Bitwise
Bitwise not ~
And &
Xor ^
Shift left <<
Shift right >>
In [8]:
Out[8]:
-3
In [9]:
Out[9]:
2
In [10]:
Out[10]:
5
Boolean Operation
And
OR
In [13]:
Out[13]:
False
In [15]:
Out[15]:
True
Relational operators
Equals
=
Not equals
!=
Greater than
>
Greater or equal
>=
Less than
<
Less or equal
<=
In [16]:
Out[16]:
False
In [17]:
Out[17]:
True
In [18]:
Out[18]:
True
IO Operations
input()
print()
int()
float()
str()
len()
In [21]:
Out[21]:
int
In [22]:
Out[22]:
float
In [23]:
Out[23]:
6
Type Casting (Conversion of Data Stream to another type)
In [24]:
Out[24]:
'1 + 5 = 6'
Conditional Operators
If
If-else
If-elif
If-elif-else
In [33]:
Out[33]:
X is not larger in value than Y
In [40]:
In [45]:
Out[45]:
X is not 1 and Y is 2
Loops
For
While
In [47]:
Out[47]:
0
1
2
3
4
In [ ]:
Sequences
Set
Tuple
List
Dict
In [50]:
Out[50]:
1
2
3
4
5
In [51]:
Out[51]:
1
2
3
4
5
In [49]:
Out[49]:
0
1
2
3
4
5
6
7
8
In [52]:
Out[52]:
This number 1 is odd!
This number 3 is odd!
This number 5 is odd!
This number 7 is odd!
This number 9 is odd!
In [53]:
Out[53]:
The break instruction:
Inside the loop. 1
Inside the loop. 2
Outside the loop.
The continue instruction:
Inside the loop. 1
Inside the loop. 2
Inside the loop. 4
Inside the loop. 5
Outside the loop.
In [54]:
Out[54]:
1
2
3
4
else: 5
In [56]:
Out[56]:
P*y*t*h*o*n*2
4
6
8
In [57]:
Out[57]:
pypypy