-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1prg.py
More file actions
229 lines (162 loc) · 4 KB
/
1prg.py
File metadata and controls
229 lines (162 loc) · 4 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#print("Hello World")
#Demo = 1234
#print(Demo)
#DemoClass = "2u344" # This is called Camel Case because D and C are caps
#print(DemoClass)
#_Demo1 = 123
#print(_Demo1)
#12Demo=2333
#Print(12Demo) # Error because the variable name starts with number
#Demo21 =1234
#print(Demo21)
#Demo = 1
#Demo = 2
#print(Demo) # the lastest variable value
#Demo = 1
#D =2
#print(Demo+D)
#No = (1,2,3,4,5)
#print(No)
#No = (1-5,51-9,33-8)
#print(No)
#Demo =123
#Demo1 =345
#Demo3 ="Keerthi"
#Demo2 =4667
#print(Demo,Demo1,Demo3,Demo2)
#Demo =123
#Demo1 =345
#Demo3 ="Keerthi"
#Demo2 =4667
#print(type(Demo,Demo1,Demo3))
#Demo =123
#Demo1 =345
#Demo3 ="Keerthi"
#Demo2 =4667
#print(type(Demo),type(Demo1),type(Demo3),type(Demo2))
#Demo = 133
#print(type(Demo))
#sal =200000
#New_sal = float(sal)
#print(New_sal)
#sal=200000
#print(float(sal))
#sal=80.94
#print(int(sal))
#8/01/24 ---> String place holder
#pgm = "Python is a Programming Language"
#print(pgm,"and Easy to learn")
#print('{} and easy to learn'.format(pgm)) #----> (.format)-this is called string holder/place holder
#Pgm = "string is one of the python's data type"
#print(Pgm)
#Pgm = 'string is one of the python\'s data type'
#print(Pgm)
#a= 2<3
#b=5>2
#c=a and b
#print(c)
#a= 2<3
#b=5<2
#c=a and b
#print(c)
#a= 2<3
#b=5>2
#c=a or b
#print(c)
#a= 2<1
#b=5<2
#c=a or b
#print(c)
#1st chapter String
#stringname = "Keerthi" or 'Vivi'
#fruit ="Apple"
#print(len(fruit))
#print(fruit[-2])
#print(fruit[-3])
# UPPERCASE:
#Fruit= ("i love apple")
#print(Fruit.upper())
#print(Fruit.lower())
#pgm =" Python is easy "
#print(pgm.replace(" easy "," Powerful "))
#print(pgm[0:6])
#print(pgm[9:14])
#print(pgm[-5:]) # after -5 everything will return
#print(pgm[:-5]) # before -5 everything will return
#10/01/2024 ---> List,Tuples,Dictionary
#fav_fruits =["apple","Orange","pineapple","Strawberry"]
#print(fav_fruits)
#print(fav_fruits[1])
#fav_fruits[1] ="Kiwi" # if we want to chane orange to kiwi, we have to give like this
#print(fav_fruits)
#fav_fruits.append("Gova") # Gova will be added to the list at the last
#print(fav_fruits)
#fav_fruits.insert(1,"Dragon Fruit") # insert dragon fruit in 2nd order
#print(fav_fruits)
#fav_fruits.remove("apple")
#print(fav_fruits)
#fav_fruits.sort()
#print(fav_fruits)
#num = ["4","6","56","32","76"] # order will be different, first the Caps, Small,then numbers
#num.sort()
#print(num)
#num1=[1,5,8,4,24,88]
#num1.sort()
#print(num1)
#names = ["Keerthi","Poova","Swathi","chennai"]
#names.sort()
#print(names)
#fav_fruits.reverse()
#print(fav_fruits)
#print(fav_fruits.pop()) # it will show and delete it from the list
#print(fav_fruits.pop(2)) # to delete particular value , give the index number to delete it
# Tuples
#wardates=(1913,1945)
#print(wardates)
#wardates[1]=1988
#print(wardates) # error tuples does update
#wardates.reverse()
#print(wardates) # error tuple does not reverse
#del(wardates)
# Dictionary
#cam ={"Sony":500,"Nikon":799,"Canon":654}
#print(cam)
#cam["Nikon"]=900
#print(cam)
#------- 11/01/24 ---------
#print(cam.keys())
#print(cam.values())
#copycam=cam.copy()
#print(copycam)
#del cam["Sony"]
#cam.clear
#print(cam)
#-----------------31/01/24-------------------------#
my_set={1,2,3,4,5}
print(my_set)
#---------add a set-----
my_set.add(6)
print(my_set)
#----------Removing an element from a set
my_set.remove(3)
print(my_set)
#--------set operator-
set_1={1,2,3,4,5,6}
set_2={5,6,7,8,9}
union_set=set_1.union(set_2)
print(union_set)
intersection_set=set_1.intersection(set_2)
print(intersection_set)
set_difference=set_1.difference(set_2)
print(set_difference)
print(2 in set_1)
print(9 in set_1)
original_set={1,2,3,4,5}
print("original_set:",original_set)
#----------convert the set to list and convert it back to set
reversed_set=set(reversed(list(original_set)))
print(reversed_set)
list=list(original_set)
list.reverse()
reversed_set = set(list)
print(reversed_set)