15. Revision notes
15.1. Truth tables
0 is False
, 1 is True
.
A |
B |
A AND B |
---|---|---|
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
A |
B |
A OR B |
---|---|---|
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
A |
B |
A XOR B |
---|---|---|
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
0 |
A |
NOT A |
---|---|
0 |
1 |
1 |
0 |
15.2. Data types
Type |
Examples |
Meaning |
---|---|---|
bool |
True, False |
Boolean |
int |
1, 5, 0, -3 |
Integer |
float |
1.0, 0.56, -17.1 |
Floating point, real |
str |
‘abc’, “hello”, “10” |
String |
char |
‘a’, ‘z’ |
Character 1 |
list |
[1, 2, 3] |
List |
dict |
{‘a’: 1} |
Dictionary |
noo
foo woo sdf
sdfs
Note
this is a note note foo
sdfsdf
Tip
this is a tip note foo
sdfsdf
And, by the way…
You can make up your own admonition too.
- 1
Character is not a type in Python, it is just a string of length 1.