Skip to content

Commit 59f77b9

Browse files
committed
add primitive types
1 parent b717e17 commit 59f77b9

File tree

1 file changed

+83
-2
lines changed

1 file changed

+83
-2
lines changed

README.md

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,65 @@
22

33

44
## Primitive Types
5+
1. Integers (`int`).
6+
1. Floats (`float`).
7+
1. Strings (`str`).
8+
1. Booleans (`bool`).
9+
10+
```python
11+
>>> i, f, s, b = 12, 8.31, 'Hello, world!', True
12+
>>> type(i) # <class 'int'> ~ Unbounded
13+
>>> type(f) # <class 'float'> ~ Bounded
14+
>>> type(s) # <class 'str'>
15+
>>> type(b) # <class 'bool'>
16+
17+
>>> str(i)
18+
'12'
19+
>>> float(i)
20+
12.0
21+
>>> str(b)
22+
'True'
23+
>>> int('10')
24+
10
25+
>>> bool('a')
26+
True
27+
>>> bool(1)
28+
True
29+
>>> bool('')
30+
False
31+
>>> bool(0.0)
32+
False
33+
>>> bool(0)
34+
False
35+
36+
>>> min(i, 1)
37+
1
38+
>>> max(i, 1)
39+
12
40+
>>> max(i, f)
41+
12
42+
43+
>>> pow(2, 3)
44+
8
45+
>>> 2 ** 3
46+
8
47+
48+
>>> import math
49+
>>> math.ceil(7.2)
50+
8
51+
>>> math.floor(7.2)
52+
7
53+
>>> math.sqrt(4)
54+
2.0
55+
56+
>>> float('inf') # Pseudo max-int
57+
inf
58+
>>> float('-inf') # Pseudo min-int
59+
-inf
60+
```
61+
62+
63+
### Bit manipulation
564
TODO
665

766

@@ -87,6 +146,28 @@ TODO
87146
## Hash Tables
88147
TODO
89148

90-
## Other
91149

92-
### collections
150+
## Heaps
151+
TODO
152+
153+
154+
## Searching
155+
TODO
156+
157+
158+
## collections
159+
160+
161+
### namedtuple
162+
TODO
163+
164+
165+
### Counter
166+
TODO
167+
168+
169+
### defaultdict
170+
TODO
171+
172+
173+
### OrderedDict

0 commit comments

Comments
 (0)