-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdata_types.py
More file actions
63 lines (36 loc) · 693 Bytes
/
data_types.py
File metadata and controls
63 lines (36 loc) · 693 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
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
# 3. Data Types:
# 1. String = xarfo, example
x = "Duraan"
y = 10
myString = str(y)
print(type(myString))
# 2. Integar
x = 20
y = -20
myNum = 2.5
myNumInt = int(myNum)
print(type(myNumInt))
# 3. Float
x = 4.5
y = 10
flt = float(y)
print(flt)
# 4. list
x = ["moos", "canbo", "qaro"]
myItems = (("hilib", "bariis", "sonkor"))
myList = list(myItems)
print(x)
# 5. Tuple
x = ("hilib", "bariis", "sonkor")
items = (("hilib", "bariis", "sonkor"))
myTyple = tuple(items)
# 6. Dictionary
x = {"name": "abdi", "age": 30}
y = dict(name="abdi", age=30)
print(type(y))
# 7. Set
x = {"canab", "canbo", "moos"}
mySet = set()
# 8. Bool
True or False
# 4. Casting - Badal data type