-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDataType.py
More file actions
62 lines (49 loc) · 1.03 KB
/
Copy pathDataType.py
File metadata and controls
62 lines (49 loc) · 1.03 KB
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
# int data type
int = 1234
print(int, "is the integer value")
# string data type
string = "Name is a string"
print(string)
# String concatenation
name1 = "Zannatul"
name2 = "Farzana"
print(name1+name2)
print("My name is"+" "+name2)
# compare
x = 10
y = 5
print(x == y)
print(x > y)
# binary type(bytes) [range is 0-256]
list1 = [1, 2, 200, 100]
b1 = bytes(list1)
# bytes value cannot be changed(like b[0]=10)= immutable
print(list1)
# binary type(byte array) [range is 0-256]
list2 = [1, 2, 200, 100]
b2 = bytearray(list2)
b2[1] = 10
print(b2[1])
# none type (define NULL value)
x = None
print(type(x))
# list type data
l1 = ["maria", "afridi", "efath", "sumaiya"] # mutable(can change)
l1[2] = "aziz"
print(l1)
# tuple type data
t1 = (5, 10, 15, 20) # immutable
print(t1)
# range type data
ran = range(6)
for i in ran:
print(i)
# Check data type
com = 123j
print("com is", type(com))
checkBool = False
print("checkBool", type(checkBool))
print("b1", type(b1))
print("b2", type(b2))
print("l1 is", type(l1))
print("t1 is", type(t1))