-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8_Python_Data_Types.py
57 lines (50 loc) · 1.03 KB
/
8_Python_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
# Python Data Types
# Getting the data type
x = 1
print(type(x))
print("")
# Data types
a = 10
b = "Hello World!"
c = 3.45
d = 1j
e = ['Mango', 'Banana', 'Watermelon']
f = ('Ferrari', 'BMW', 'Nissan')
g = range(5)
h = {"name": "Zaber", "age": 29}
i = {"Apple", "Cherry", "Grape"}
j = frozenset({"Android", "Windows", "iOS"})
k = True
l = b'World'
m = bytearray(5)
n = memoryview(bytes(5))
o = None
print(type(a)) # int
print(type(b)) # str
print(type(c)) # float
print(type(d)) # complex
print(type(e)) # list
print(type(f)) # tuple
print(type(g)) # range
print(type(h)) # dict
print(type(i)) # set
print(type(j)) # frozenset
print(type(k)) # bool
print(type(l)) # bytes
print(type(m)) # bytearray
print(type(n)) # memoryview
print(type(o)) # NoneType
print("")
# Setting specific data type
p = int(5)
print(p)
print(type(p)) # int
q = list(('Audi','Marcedes','Toyota'))
print(q)
print(type(q)) # list
r = dict(name='Zaber',age=29)
print(r)
print(type(r)) # dict
s = set(("Red","Green","Blue"))
print(s)
print(type(s)) # set