-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_types.py
66 lines (41 loc) · 1.5 KB
/
data_types.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
###################################
# #
# #
# DATA TYPES in python #
# #
# #
###################################
# built in data types of python ...
# Text Type : str
# Numeric Types : int, float, complex
# Sequence Types: list, tuple, range
# Mapping Type : dict
# Set Types : set, frozenset
# Boolean Type : bool
# Binary Types : bytes, bytearray, memoryview
# None Type : NoneType
# You can get the data type of any object by using the type() function.
print(type(5))
# it will print as class 'int'
print(type(3.4))
# it will print as class 'float'
print(type("Python"))
# it will print as class 'str' // that means string ..
# only we give these sentence or lines or letter in double quotation or single quotation for strings.
print(type(2j))
# it will print as class 'complex' ..
# complex value ...
# for list
a = []
print(type(a))
# it will print as class 'list' becoz of [] these...
# '[]' these are list data types
b = ()
print(type(b))
# it will print as class 'tuple' becoz of () these ...
# '()' these are tuple data types
c = {}
print(type(c))
# it will print as class 'dict' becoz of {} these ...
# '{}' these are dict data types
# likewise all data types have a built - in - types