-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassworkout.py
More file actions
299 lines (287 loc) · 10.9 KB
/
classworkout.py
File metadata and controls
299 lines (287 loc) · 10.9 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
Python 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] on win32
Enter "help" below or click "Help" above for more information.
dictionaryname['new key']='new value'
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
dictionaryname['new key']='new value'
NameError: name 'dictionaryname' is not defined
class6['New student']='Ayman Taqi'
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
class6['New student']='Ayman Taqi'
NameError: name 'class6' is not defined
class6{}
SyntaxError: invalid syntax
classe6()
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
classe6()
NameError: name 'classe6' is not defined
class6=[]
class6={}
class6
{}
class6=[]
class6
[]
class6={}
class6
{}
class6['new student']='Shaik Ayman Taqi'
class6
{'new student': 'Shaik Ayman Taqi'}
class6['new student']='Sk Manha junaina'
class6
{'new student': 'Sk Manha junaina'}
class6.'new student'
SyntaxError: invalid syntax
class6['new student']
'Sk Manha junaina'
class6['roll number']='34'
class6['dob']=11-11-1990
class6['dob']="11-11-1990'
SyntaxError: unterminated string literal (detected at line 1)
class6['dob']="11-11-1990"
class6['Place']='Kothagudem'
class6
{'new student': 'Sk Manha junaina', 'roll number': '34', 'dob': '11-11-1990', 'Place': 'Kothagudem'}
class6['place']
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
class6['place']
KeyError: 'place'
class6.['place']
SyntaxError: invalid syntax
class6['Place']
'Kothagudem'
class6['place2']='bhadradri'
class6
{'new student': 'Sk Manha junaina', 'roll number': '34', 'dob': '11-11-1990', 'Place': 'Kothagudem', 'place2': 'bhadradri'}
class6['place2']
'bhadradri'
class6.get(new students',"check the keyname properly")
SyntaxError: unterminated string literal (detected at line 1)
class6.get('new students',"check the keyname properly")
'check the keyname properly'
class6.get('new students')
class6.get('new student','chck properly')
'Sk Manha junaina'
class6
{'new student': 'Sk Manha junaina', 'roll number': '34', 'dob': '11-11-1990', 'Place': 'Kothagudem', 'place2': 'bhadradri'}
class6.pop
<built-in method pop of dict object at 0x000002131BE9ECC0>
class
SyntaxError: invalid syntax
class6
{'new student': 'Sk Manha junaina', 'roll number': '34', 'dob': '11-11-1990', 'Place': 'Kothagudem', 'place2': 'bhadradri'}
class6.pop()
Traceback (most recent call last):
File "<pyshell#37>", line 1, in <module>
class6.pop()
TypeError: pop expected at least 1 argument, got 0
class6(pop)
Traceback (most recent call last):
File "<pyshell#38>", line 1, in <module>
class6(pop)
NameError: name 'pop' is not defined. Did you mean: 'pow'?
class6.pop
<built-in method pop of dict object at 0x000002131BE9ECC0>
class6
{'new student': 'Sk Manha junaina', 'roll number': '34', 'dob': '11-11-1990', 'Place': 'Kothagudem', 'place2': 'bhadradri'}
d={
... "list_data" : [1,2,3,4,5,6,7,8,9],
... "tuple_data" : (1,2,3,4,5,6),
... 'int_data' : 1111,
... "string": "Sphoorthi",
... "anthr_dict" : { 'a':1,
... "b":2
... }
SyntaxError: '{' was never closed
d={
... "list_data" : [1,2,3,4,5,6,7,8,9],
... "tuple_data" : (1,2,3,4,5,6),
... 'int_data' : 1111,
... "string": "Sphoorthi",
... "anthr_dict" : { 'a':1,
... "b":2
... }
SyntaxError: '{' was never closed
d={
... "list_data" : [1,2,3,4,5,6,7,8,9],
... "tuple_data" : (1,2,3,4,5,6),
... 'int_data' : 1111,
... "string": "Sphoorthi",
... "anthr_dict" : { 'a':1,
... "b":2
... }}
SyntaxError: invalid syntax. Perhaps you forgot a comma?
d={
... "list_data" : [1,2,3,4,5,6,7,8,9],
... "tuple_data" : (1,2,3,4,5,6),
... 'int_data' : 1111,
... "string": "Sphoorthi",
... "anthr_dict" : { 'a':1,
... "b":2
... },}
SyntaxError: invalid syntax. Perhaps you forgot a comma?
d={
... "list_data" : [1,2,3,4,5,6,7,8,9],
... "tuple_data" : (1,2,3,4,5,6),
... 'int_data' : 1111,
... "string": "Sphoorthi",
... "anthr_dict" : { 'a':1,
... "b":2
... }}
SyntaxError: invalid syntax. Perhaps you forgot a comma?
d={
... "list_data" : [1,2,3,4,5,6,7,8,9],
... "tuple_data" : (1,2,3,4,5,6),
... 'int_data' : 1111,
... "string": "Sphoorthi",
... "anthr_dict" : { 'a':1,
... "b":2
... },
SyntaxError: '{' was never closed
d={
... "list_data" : [1,2,3,4,5,6,7,8,9],
... "tuple_data" : (1,2,3,4,5,6),
... 'int_data' : 1111,
... "string": "Sphoorthi",
... "anthr_dict" : { 'a':1,
... "b":2
... } }
SyntaxError: invalid syntax. Perhaps you forgot a comma?
class6
{'new student': 'Sk Manha junaina', 'roll number': '34', 'dob': '11-11-1990', 'Place': 'Kothagudem', 'place2': 'bhadradri'}
e={'a':12,'b':45}
e
{'a': 12, 'b': 45}
e={'a':12,'b':13,'c':14,'c':34}
e
{'a': 12, 'b': 13, 'c': 34}
e['a']
12
e['new_str']=''asma shaik'
SyntaxError: unterminated string literal (detected at line 1)
e['new_str']='asma shaik'
e
{'a': 12, 'b': 13, 'c': 34, 'new_str': 'asma shaik'}
e['new_line']='this si a new line'
e
{'a': 12, 'b': 13, 'c': 34, 'new_str': 'asma shaik', 'new_line': 'this si a new line'}
e.pop
<built-in method pop of dict object at 0x000002131E719440>
e.pop['new_line']
Traceback (most recent call last):
File "<pyshell#60>", line 1, in <module>
e.pop['new_line']
TypeError: 'builtin_function_or_method' object is not subscriptable
e['my doll']='Manha junaina'
e
{'a': 12, 'b': 13, 'c': 34, 'new_str': 'asma shaik', 'new_line': 'this si a new line', 'my doll': 'Manha junaina'}
e.values
<built-in method values of dict object at 0x000002131E719440>
e.pop('c')
34
e['new dict1']={'z':'asmaaaa','y':'jaffer','x':'zoya','w':'taqi'}
e
{'a': 12, 'b': 13, 'new_str': 'asma shaik', 'new_line': 'this si a new line', 'my doll': 'Manha junaina', 'new dict1': {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}}
e.values()
dict_values([12, 13, 'asma shaik', 'this si a new line', 'Manha junaina', {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}])
e.keys()
dict_keys(['a', 'b', 'new_str', 'new_line', 'my doll', 'new dict1'])
e['c']='34'
e
{'a': 12, 'b': 13, 'new_str': 'asma shaik', 'new_line': 'this si a new line', 'my doll': 'Manha junaina', 'new dict1': {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}, 'c': '34'}
e.remove('c')
Traceback (most recent call last):
File "<pyshell#71>", line 1, in <module>
e.remove('c')
AttributeError: 'dict' object has no attribute 'remove'
ff()
Traceback (most recent call last):
File "<pyshell#72>", line 1, in <module>
ff()
NameError: name 'ff' is not defined
dd={}
dd
{}
dd={'11','12','13','24','14'}
dd
{'12', '24', '14', '11', '13'}
e['dd']
Traceback (most recent call last):
File "<pyshell#77>", line 1, in <module>
e['dd']
KeyError: 'dd'
e['dd()']
Traceback (most recent call last):
File "<pyshell#78>", line 1, in <module>
e['dd()']
KeyError: 'dd()'
e['dd']={'11','12','13','24','14'}
e
{'a': 12, 'b': 13, 'new_str': 'asma shaik', 'new_line': 'this si a new line', 'my doll': 'Manha junaina', 'new dict1': {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}, 'c': '34', 'dd': {'12', '24', '14', '11', '13'}}
{'a': 12, 'b': 13, 'new_str': 'asma shaik', 'new_line': 'this si a new line', 'my doll': 'Manha junaina', 'new dict1': {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}, 'c': '34', 'dd': {'12', '24', '14', '11', '13'}}
{'a': 12, 'b': 13, 'new_str': 'asma shaik', 'new_line': 'this si a new line', 'my doll': 'Manha junaina', 'new dict1': {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}, 'c': '34', 'dd': {'12', '24', '14', '11', '13'}}
e.pop('dd')
{'12', '24', '14', '11', '13'}
e
{'a': 12, 'b': 13, 'new_str': 'asma shaik', 'new_line': 'this si a new line', 'my doll': 'Manha junaina', 'new dict1': {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}, 'c': '34'}
e['dd']={'12', '24', '14', '11', '13'}
e
{'a': 12, 'b': 13, 'new_str': 'asma shaik', 'new_line': 'this si a new line', 'my doll': 'Manha junaina', 'new dict1': {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}, 'c': '34', 'dd': {'12', '24', '14', '11', '13'}}
e.values()
dict_values([12, 13, 'asma shaik', 'this si a new line', 'Manha junaina', {'z': 'asmaaaa', 'y': 'jaffer', 'x': 'zoya', 'w': 'taqi'}, '34', {'12', '24', '14', '11', '13'}])
e.keys()
dict_keys(['a', 'b', 'new_str', 'new_line', 'my doll', 'new dict1', 'c', 'dd'])
details
{'company': 'maggi', 'country': 'austria', 'projects': 'Business Intelligence'}
SyntaxError: multiple statements found while compiling a single statement
details={}
details
{'company': 'maggi', 'country': 'austria', 'projects': 'Business Intelligence'}
SyntaxError: multiple statements found while compiling a single statement
details={}
{'company': 'maggi', 'country': 'austria', 'projects': 'Business Intelligence'}
SyntaxError: multiple statements found while compiling a single statement
details
{}
details{'company':'maggi','country'='india','projects':'BI'}
SyntaxError: ':' expected after dictionary key
details{'company':'maggi','country':'india','projects':'BI'}
SyntaxError: invalid syntax
details={'company':'maggi','country':'india','projects':'BI'}
details
{'company': 'maggi', 'country': 'india', 'projects': 'BI'}
details['company']
'maggi'
details['proj']
Traceback (most recent call last):
File "<pyshell#103>", line 1, in <module>
details['proj']
KeyError: 'proj'
details['proj','give corrrect keyname']
Traceback (most recent call last):
File "<pyshell#104>", line 1, in <module>
details['proj','give corrrect keyname']
KeyError: ('proj', 'give corrrect keyname')
details['another dict']={}
details
{'company': 'maggi', 'country': 'india', 'projects': 'BI', 'another dict': {}}
details['fruits dictionary']={'a':'apple','b':'banana','c':'capsicum','d':'dosa'}
details['fruits dictionary']
{'a': 'apple', 'b': 'banana', 'c': 'capsicum', 'd': 'dosa'}
deatils
Traceback (most recent call last):
File "<pyshell#109>", line 1, in <module>
deatils
NameError: name 'deatils' is not defined. Did you mean: 'details'?
details
{'company': 'maggi', 'country': 'india', 'projects': 'BI', 'another dict': {}, 'fruits dictionary': {'a': 'apple', 'b': 'banana', 'c': 'capsicum', 'd': 'dosa'}}
details.keys
<built-in method keys of dict object at 0x000002131E719400>
details.keys()
dict_keys(['company', 'country', 'projects', 'another dict', 'fruits dictionary'])
details.values()
dict_values(['maggi', 'india', 'BI', {}, {'a': 'apple', 'b': 'banana', 'c': 'capsicum', 'd': 'dosa'}])