-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path#6-numbers.py
27 lines (20 loc) · 854 Bytes
/
#6-numbers.py
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
import random # add random module to get random number
# There are Three type of number in Python
# int
x = 56 # a whole number without limit can be positive or negetive
x1 = -55676454
x2 = 35834357545345617531453
# float
y = 5.8 # can be positive or negetive or can be Exponent and negetive Exponent
y1 = - 6.656
y2 = 52e5
y3 = -5E7
# complex number denoted by j
z = 5j
# type conversion
a = float(x) # this will convert x to a float number
b = int(y) # this will convert y to a integer number
c = complex(x) # this will convert x to a complex number
# ! you cannot convert complex numbers into any other format !
randomNumGenerator = random.randrange(1,10) # this will generate random number by adding 'start' and 'stop' parameter
print(randomNumGenerator)