Operators Flashcards
(27 cards)
1
Q
+
A
addition
2
Q
-
A
subtraction
3
Q
*
A
multiplication
4
Q
**
A
power of
5
Q
/
A
division
6
Q
//
A
floor division
2 // 4.0 == 0.0
7
Q
%
A
string interpolate or modulus
2 % 4 == 2
8
Q
<
A
less than
9
Q
>
A
greater than
10
Q
<=
A
less than equal
11
Q
> =
A
greater than equal
12
Q
==
A
equal
13
Q
!=
A
not equal
14
Q
<>
A
not equal
15
Q
( )
A
paren
16
Q
[ ]
A
list brackets
17
Q
{ }
A
dict curly braces
{ ‘x’: 5, ‘y’: 10 }
18
Q
@
A
at (decorators
@classmethod
19
Q
=
A
assign equal
20
Q
;
A
semi colon
print “hi”; print “there”
21
Q
+=
A
add and assign
x = 1; x += 2
22
Q
-=
A
subtract and assign
x = 1; x -= 2
23
Q
*=
A
multiply and assign
x = 1; x *= 2
24
Q
/=
A
divide and assign
x = 1; x /= 2
25
//=
floor divide and assign
x = 1; x //= 2
26
%=
modulus assign
x = 1; x %= 2
27
**=
power assign
x = 1; x **= 2