-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule2_class2.py
146 lines (118 loc) · 2.59 KB
/
module2_class2.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
"""for i in range(1,10):
print(" page no: ", i)"""
# Loop Over List
"""city_list=["Dhaka","Rangpur","Barisal"]
for city in city_list:
print(city)"""
#=========For loop Over string=======================
"""
string="Rabbil Hasan"
for ctr in string:
print(ctr)"""
# For Loop Over Rang
"""for i in range(10):
print(i)"""
name="Rabbil"
"""for ctr in name:
if(ctr=="i"):
break
print(ctr)"""
"""for ctr in name:
if(ctr=="i"):
continue
print(ctr)"""
# While Loop Over List
"""fruits=["Apple","Banana","Orange","Mango"]
i=0
while(i<len(fruits)):
if (fruits[i] == "Banana"):
continue
print(fruits[i])
i=i+1"""
# while loop over string
"""name="Rabbil"
index=0
while(index<len(name)):
print(name[index])
index +=1"""
# While loop for range
"""start=0
end=10
while start<=end:
print(start)
start +=1"""
"""i=1
while(i<=5):
print(i)
i=i+1"""
# while loop in continue
"""counter=0
while counter<10:
counter+=1
if counter%2==0:
continue
print(counter)"""
# What is List? Array []
# Order Collection , has index number
# Mutable Daty Type (do not change location) only change itself
# List Allow Duplicate data
#
#cit_list=["Dhaka","Bagura","Rangpur","Tangail","Khulna","Faridpur"]
#print(id(cit_list))
# add item in the last
#cit_list.append("Syhlet")
# add item in index postion
#cit_list.insert(2,"Magura")
#print(id(cit_list))
#city2=["London","Vancouver"]
#cit_list.extend(city2)
# remove item in list
#cit_list.remove("Bagura")
#pop remove the last item
#cit_list.pop()
# clear method remove all item in list
#cit_list.clear()
# index method return the index of list
#print(cit_list.index("Dhaka"))
#print(cit_list.count("Dhaka"))
#numbers=[2,3,21,4,12,55,3]
#numbers.sort()
#numbers.reverse()
#print(numbers)
## What is Tuple? ()
# Order Collection , has index number
# immutable Daty Type ( change location)
# Tupple Allow Duplicate data
#
fruits=("Apple","Charry","Banana","Charry","Banana")
#print(id(fruits))
#fruits=("Apple","Charry")
#print(id(fruits))
#print(fruits[1])
#method in List
# count method
#count=fruits.count("Charry")
#print(count)
"""
postion=fruits.index("Cherry")
print(postion)"""
#fruitList=list(fruits)
#print(fruitList)
# set
# Unorder List
# Mutable Data Type
# Does not allow duplicate Data
#fruits={"Apple","Banana","Charry","Banana","Charry"}
#print(id(fruits))
# item add in set
#fruits.add("Mango")
#print(id(fruits))
"""fruits.update("A","B")
# remove method remove one item
fruits.remove("A")
# clear method empty the set
fruits.clear()
print(fruits)"""
# Dictonary Data Type
persons={
}