-
Notifications
You must be signed in to change notification settings - Fork 0
/
inheritance.py
540 lines (423 loc) · 15.6 KB
/
inheritance.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
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
import logging
logging.basicConfig(filename="inheritance.log", level=logging.INFO, format= '%(levelname)s %(asctime)s %(name)s %(message)s')
# inheritance
# multiple inheritance
# Example 1
class ineuron6:
logging.info("This is a class called ineuron6")
try:
logging.info("Creating methods in the class inuron6")
def ineuron_students(self):
print("List out the details of all the ineuron students")
logging.info("List out the details of all the ineuron students")
def no_of_courses(self):
print("List out all the courses offered by ineuron")
logging.info("List out all the courses offered by ineuron")
def job_guarantee_courses(self):
print("List out the details of all the job guarantee courses offered by ineuron")
logging.info("List out the details of all the job guarantee courses offered by ineuron")
except Exception as e:
logging.exception(e)
print(e)
class ineuron_6:
logging.info("This is a class called ineuron_6")
try:
logging.info("Creating methods in the class inuron_6")
def student_login(self):
print("List out all the student login details")
logging.info("List out all the student login details")
def ineuron_signup(self):
print("List out all the details to be filled during signup")
logging.info("List out all the student login details")
except Exception as e:
logging.exception(e)
print(e)
class ineuron_6_:
logging.info("This is a class called ineuron_6_")
try:
logging.info("Creating method in the ineuron_6_ class")
def internship(self):
print("List out all the internship field available")
logging.info("List out all the internship field available")
except Exception as e:
logging.exception(e)
print(e)
class i6(ineuron6, ineuron_6, ineuron_6_):
logging.info("This is a class called i6")
pass
six = i6()
six.ineuron_students()
six.no_of_courses()
six.job_guarantee_courses()
six.student_login()
six.ineuron_signup()
six.internship()
logging.info(six.ineuron_students())
logging.info(six.no_of_courses())
logging.info(six.job_guarantee_courses())
logging.info(six.student_login())
logging.info(six.ineuron_signup())
logging.info(six.internship())
# inheritance
# multiple inheritance
# Example 2
class student6:
logging.info("This is a class called student6")
try:
logging.info("Creating methods in the class called student6")
def student_name6(self):
print("List out the names of all the students")
logging.info("List out the names of all the students")
def enrollment_no6(self):
print("List out the enrollment numbers of all the students")
logging.info("List out the enrollment numbers of all the students")
def id_no6(self):
print("List out the id numbers of all the students")
logging.info("List out the id numbers of all the students")
except Exception as e:
logging.exception(e)
print(e)
class student_6:
logging.info("This is a class called student_6")
try:
logging.info("Creating methods in the class called student_6")
def course_name6(self):
print("List out the all course names taken by the student")
logging.info("List out the all course names taken by the student")
def course_duration6(self):
print("List out the duration of each individual course")
logging.info("List out the duration of each individual course")
except Exception as e:
logging.exception(e)
print(e)
class student_6_(student6, student_6):
logging.info("This is a class called student_6_")
pass
s6 = student_6_()
s6.student_name6()
s6.enrollment_no6()
s6.id_no6()
s6.course_name6()
s6.course_duration6()
logging.info(s6.student_name6())
logging.info(s6.enrollment_no6())
logging.info(s6.id_no6())
logging.info(s6.course_name6())
logging.info(s6.course_duration6())
# inheritance
# multiple inheritance
# Example 3
class courses6:
logging.info("This is a class called courses6")
try:
logging.info("Creating methods in the courses6 class")
def course_name6(self):
print("List out the name of all the courses offered")
logging.info("List out the name of all the courses offered")
def no_of_courses6(self):
print("List out the number of courses offered")
logging.info("List out the number of courses offered")
except Exception as e:
loggin.exception(e)
print(e)
class courses_6:
logging.info("This is another class called courses_6")
try:
logging.info("Creating methods in the course_6 class")
def course_duration6(self):
print("List out the course duration of each individual course")
logging.info("List out the course duration of each individual course")
def course_modules6(self):
print("List out the number of modules in each course respectively")
logging.info("List out the number of modules in each course respectively")
except Exception as e:
loggin.exception(e)
print(e)
class courses_6_(courses6, courses_6):
logging.info("This is another class called courses_6_")
pass
c6 = courses_6_()
c6.course_name6()
c6.no_of_courses6()
c6.course_duration6()
c6.course_modules6()
logging.info(c6.course_name6())
logging.info(c6.no_of_courses6())
logging.info(c6.course_duration6())
logging.info(c6.course_modules6())
# inheritance
# multiple inheritance
# Example 4
class blogs6:
logging.info("This is a class called blogs6")
try:
logging.info("Creating methods in the blogs6 class")
def blog_title6(self):
print("List out only the titles of the blogs on the website")
logging.info("List out only the titles of the blogs on the website")
def no_of_blogs6(self):
print("List out the number of blogs based on the individual categories")
logging.info("List out the number of blogs based on the individual categories")
except Exception as e:
logging.exception(e)
print(e)
class blogs_6:
logging.info("This is a class called blogs_6")
try:
logging.info("Creating methods inside the blogs_6 class")
def blog_category6(self):
print("List out the different categories")
logging.info("List out the different categories")
def archive6(self):
print("List the archives on the website")
logging.info("List the archives on the website")
except Exception as e:
logging.exception(e)
print(e)
class blogs_6_(blogs6, blogs_6):
logging.info("This is another class called blogs_6_")
pass
b6 = blogs_6_()
b6.blog_title6()
b6.no_of_blogs6()
b6.blog_category6()
b6.archive6()
logging.info(b6.blog_title6())
logging.info(b6.no_of_blogs6())
logging.info(b6.blog_category6())
logging.info(b6.archive6())
# inheritance
# multiple inheritance
# Example 5
class internship6:
logging.info("This is a class called internship6")
try:
logging.info("Creating methods in the internship6 class")
def student_name6(self):
print("List out the names of all the students that are in the internship program")
logging.info("List out the names of all the students that are in the internship program")
def student_id_no6(self):
print("List out the id number of all the students")
logging.info("List out the id number of all the students")
except Exception as e:
logging.exception(e)
print(e)
class internship_6:
logging.info("This is another class called internship_6")
try:
logging.info("Creating methods in the internship_6 class")
def domain_name6(self):
print("List all the names of the domains that are available for download")
logging.info("List all the names of the domains that are available for download")
def internship_duration(self):
print("List out the duration of internship according to each individual domain")
logging.info("List out the duration of internship according to each individual domain")
except Exception as e:
logging.exception(e)
print(e)
class internship_6_(internship6, internship_6):
logging.info("This is another class called internship_6_")
pass
intern6 = internship_6_()
intern6.student_name6()
intern6.student_id_no6()
intern6.domain_name6()
intern6.internship_duration()
logging.info(intern6.student_name6())
logging.info(intern6.student_id_no6())
logging.info(intern6.domain_name6())
logging.info(intern6.internship_duration())
# inheritance
# multi-level inheritance
# Example 6
class ineuron5:
logging.info("This is a class called ineuron5")
try:
logging.info("Creating methods inside the ineuron5 class")
def courses(self):
print("List out all the courses that are offered")
logging.info("List out all the courses that are offered")
def no_of_courses(self):
print("List of the total number of courses available")
logging.info("List out all the courses that are offered")
def internship(self):
print("List out all the fields of internship offered")
except Exception as e:
logging.exception(e)
print(e)
class FSDS(ineuron5):
logging.info("This is a class called FSDS")
try:
logging.info("Creating method inside the FSDS class")
def no_of_modules(self):
print("List all the modules that needs to be completed to finish the entire FSDS course")
logging.info("List all the modules that needs to be completed to finish the entire FSDS course")
except Exception as e:
logging.exception(e)
print(e)
class FSDS_student_portal(FSDS):
logging.info("This is a class called FSDS_student_portal")
pass
FSDS_sp = FSDS_student_portal()
FSDS_sp.courses()
FSDS_sp.no_of_courses()
FSDS_sp.internship()
FSDS_sp.no_of_modules()
logging.info(FSDS_sp.courses())
logging.info(FSDS_sp.no_of_courses())
logging.info(FSDS_sp.internship())
logging.info(FSDS_sp.no_of_modules())
# inheritance
# multi-level inheritance
# Example 7
class jobs5:
logging.info("This is a class called jobs5")
try:
logging.info("Creating methods inside jobs5 class")
def emp_name5(self):
print("List out the names of all the employees")
logging.info("List out the names of all the employees")
def emp_id5(self):
print("List of the id number of the all the employees")
logging.info("List of the id number of the all the employees")
except Exception as e:
logging.exception(e)
print(e)
class jobs_5(jobs5):
logging.info("This is a class called jobs_5")
try:
logging.info("Creating methods inside the jobs_5 class")
def emp_desigination5(self):
print("List out the desigination of all the employees")
logging.info("List out the desigination of all the employees")
def emp_salary5(self):
print("List out the salaries of all the employees")
logging.info("List out the salaries of all the employees")
except Exception as e:
logging.exception(e)
print(e)
class jobs_5_(jobs_5):
logging.info("This is a class called jobs_5_")
pass
j5 = jobs_5_()
j5.emp_name5()
j5.emp_id5()
j5.emp_desigination5()
j5.emp_salary5()
logging.info(j5.emp_name5())
logging.info(j5.emp_id5())
logging.info(j5.emp_desigination5())
logging.info(j5.emp_salary5())
# inheritance
# multi-level inheritance
# Example 8
class affilates5:
logging.info("This is a class called affilates5")
try:
logging.info("Creating methods in the affilates5 class")
def affilates_name(self):
print("List out the name of all the affilates")
logging.info("List out the name of all the affilates")
def affilates_function(self):
print("List out the function of each affilates")
logging.info("List out the function of each affilates")
except Exception as e:
logging.exception(e)
print(e)
class affilates_5(affilates5):
logging.info("This is a class called affilates_5")
try:
logging.info("Creating methods in the affilates_5 class")
def no_of_affilates5(self):
print("List out the numbers of affilates")
logging.info("List out the numbers of affilates")
except Exception as e:
logging.exception(e)
print(e)
class affilates_5_(affilates_5):
logging.info("This is a class called affilates_5_")
pass
a5 = affilates_5_()
a5.affilates_name()
a5.affilates_function()
a5.no_of_affilates5()
logging.info(a5.affilates_name())
logging.info(a5.affilates_function())
logging.info(a5.no_of_affilates5())
# inheritance
# multi-level inheritance
# Example 9
class class_type5:
logging.info("This is a class called class_type5")
try:
logging.info("Creating methods in the class_type5 class")
def student_name5(self):
print("List out the names of all the students")
logging.info("List out the names of all the students")
def course_name5(self):
print("List out the name of all the courses")
logging.info("List out the name of all the courses")
except Exception as e:
logging.exception(e)
print(e)
class class_type_5(class_type5):
logging.info("This is a class called class_type_5")
try:
logging.info("Creating methods in the class_type_5 class")
def course_module5(self):
print("List out the number of modules in each course")
logging.info("List out the number of modules in each course")
def course_duration5(self):
print("List out the duration of each course")
logging.info("List out the duration of each course")
except Exception as e:
logging.exception(e)
print(e)
class class_type_5_(class_type_5):
logging.info("This is a class called class_type_5")
pass
ct5 = class_type_5_()
ct5.student_name5()
ct5.course_name5()
ct5.course_module5()
ct5.course_duration5()
logging.info(ct5.student_name5())
logging.info(ct5.course_name5())
logging.info(ct5.course_module5())
logging.info(ct5.course_duration5())
# inheritance
# multi-level inheritance
# Example 10
class hackathon5:
logging.info("This is a class called hackathon5")
try:
logging.info("Creating methods in the hackathon5 class")
def team_name5(self):
print("List out the names of all the teams")
logging.info("List out the names of all the teams")
def no_of_team_members5(self):
print("List out the number of team members in each team")
logging.info("List out the number of team members in each team")
except Exception as e:
logging.exception(e)
print(e)
class hackathon_5(hackathon5):
logging.info("This is a class called hackathon_5")
try:
logging.info("Creating methods in the hackathon_5 class")
def project_title5(self):
print("List out the project titles")
logging.info("List out the project titles")
except Exception as e:
logging.exception(e)
print(e)
class hackathon_5_(hackathon_5):
logging.info("This is a class called hackathon_5_")
pass
hat5 = hackathon_5_()
hat5.team_name5()
hat5.no_of_team_members5()
hat5.project_title5()
logging.info(hat5.team_name5())
logging.info(hat5.no_of_team_members5())
logging.info(hat5.project_title5())