-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtutorial_06.py
More file actions
33 lines (30 loc) · 825 Bytes
/
tutorial_06.py
File metadata and controls
33 lines (30 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# All these are objects, so we can create a new integer, float, or complex number by using the class name and parentheses, which will call its constructor..
### Integers are whole numbers, they do not contain any decimals.
a = 12 # 12
b = -543 # -543
c = +92381201 # 92381201
d = int(3) # 3
e = int(6.1235) # 6
f = int(6.98994) # 6
g = int("512") # 512
h = int("-8") # -8
### Floats are integers that allow decimal places.
i = 3.0
j = 0.1235
k = +987546.56
l = float(105)
m = float(-12.123)
n = float("56")
o = float("63.2")
p = float("inf") # positive infinity
q = float("-inf") # negative infinity
r = float("nan") # not a number
s = 3e12
t = -87E4
u = 2e-20
### Complex numbers, have a real and an imaginary part
v = 8 + 23j
w = -9.21 + 4J
x = 200j
y = complex(23)
z = 23 + 0j