-
Notifications
You must be signed in to change notification settings - Fork 0
/
private.py
210 lines (178 loc) · 7.03 KB
/
private.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
import logging
logging.basicConfig(filename="private.log", level=logging.INFO, format='%(levelname)s %(asctime)s %(name)s %(message)s')
#Example 1
class ineuron1:
logging.info("This is a class called ineuron1")
try:
def __init__(self, student_name1, no_of_courses1):
logging.info("Creating private variables inside the constructor for ineuron1 class")
self.__student_name1 = student_name1
self.__no_of_courses1 = no_of_courses1
except Exception as e:
logging.exception(e)
print(e)
iv1 = ineuron1("Alice Wonderland", 1)
print(iv1._ineuron1__student_name1)
print(iv1._ineuron1__no_of_courses1)
logging.info(iv1._ineuron1__student_name1)
logging.info(iv1._ineuron1__no_of_courses1)
# Example 2
class student1:
logging.info("This is a class called student1")
try:
def __init__(self, stud_name1, enrollment_no1, id_no1):
logging.info("Creating private variables inside the constructor for student1 class")
self.__stud_name1 = stud_name1
self.__enrollment_no1 = enrollment_no1
self.__id_no1 = id_no1
except Exception as e:
logging.exception(e)
print(e)
s1 = student1("Bella", 12345, 102)
print(s1._student1__stud_name1)
print(s1._student1__enrollment_no1)
print(s1._student1__id_no1)
logging.info(s1._student1__stud_name1)
logging.info(s1._student1__enrollment_no1)
logging.info(s1._student1__id_no1)
# Example 3
class courses1:
logging.info("This is a class called courses1")
try:
def __init__(self, course_name1, no_of_courses1):
logging.info("Creating private variables inside the constructor for courses1 class")
self.__course_name1 = course_name1
self.__no_of_courses1 = no_of_courses1
except Exception as e:
loggin.exception(e)
print(e)
c1 = courses1("Data Science", 1)
print(c1._courses1__course_name1)
print(c1._courses1__no_of_courses1)
logging.info(c1._courses1__course_name1)
logging.info(c1._courses1__no_of_courses1)
# Example 4
class blogs1:
logging.info("This is a class called blogs1")
try:
def __init__(self, blog_title1, no_of_blogs1):
logging.info("Creating private variables inside the constructor for blogs1 class")
self.__blog_title1 = blog_title1
self.__no_of_blogs1 = no_of_blogs1
except Exception as e:
logging.exception(e)
print(e)
b1 = blogs1("This is a blog title", 2)
print(b1._blogs1__blog_title1)
print(b1._blogs1__no_of_blogs1)
logging.info(b1._blogs1__blog_title1)
logging.info(b1._blogs1__no_of_blogs1)
# Example 5
class internship1:
logging.info("This is a class called internship1")
try:
def __init__(self, student_name1, student_id_no1, course_name1, internship_duration1):
logging.info("Creating private variables inside the constructor for internship1 class")
self.__student_name1 = student_name1
self.__student_id_no1 = student_id_no1
self.__course_name1 = course_name1
self.__internship_duration1 = internship_duration1
except Exception as e:
logging.exception(e)
print(e)
intern1 = internship1("AlpaBeta", 103, "Blockchain", "6 months")
print(intern1._internship1__student_name1)
print(intern1._internship1__student_id_no1)
print(intern1._internship1__course_name1)
print(intern1._internship1__internship_duration1)
logging.info(intern1._internship1__student_name1)
logging.info(intern1._internship1__student_id_no1)
logging.info(intern1._internship1__course_name1)
logging.info(intern1._internship1__internship_duration1)
# Example 6
class jobs1:
logging.info("This is a class called jobs1")
try:
def __init__(self, emp_name1, emp_id1, emp_salary1):
logging.info("Creating private variables inside the constructor for jobs1 class")
self.__emp_name1 = emp_name1
self.__emp_id1 = emp_id1
self.__emp_salary1 = emp_salary1
except Exception as e:
logging.exception(e)
print(e)
j1 = jobs1("Jimmy Xyz", 1009, 30000)
print(j1._jobs1__emp_name1)
print(j1._jobs1__emp_id1)
print(j1._jobs1__emp_salary1)
logging.info(j1._jobs1__emp_name1)
logging.info(j1._jobs1__emp_id1)
logging.info(j1._jobs1__emp_salary1)
# Example 7
class affilates1:
logging.info("This is a class called affilates1")
try:
def __init__(self, affiltates_name1, no_of_affilates1):
logging.info("Creating private variables inside the constructor for affilates1 class")
self.__affilates_name1 = affiltates_name1
self.__no_of_affilates1 = no_of_affilates1
except Exception as e:
logging.exception(e)
print(e)
a1 = affilates1("ABC Vision", 1)
print(a1._affilates1__affilates_name1)
print(a1._affilates1__no_of_affilates1)
logging.info(a1._affilates1__affilates_name1)
logging.info(a1._affilates1__no_of_affilates1)
# Example 8
class class_type1:
logging.info("This is a class called class_type1")
try:
def __init__ (self, student_name1, course_name1):
logging.info("Creating private variables inside the constructor for class_type1 class")
self.__student_name1 = student_name1
self.__course_name1 = course_name1
except Exception as e:
logging.exception(e)
print(e)
ct1 = class_type1("sun moon", "Geography")
print(ct1._class_type1__student_name1)
print(ct1._class_type1__course_name1)
logging.info(ct1._class_type1__student_name1)
logging.info(ct1._class_type1__course_name1)
# Example 9
class student_portal1:
logging.info("This is a class called student_portal1")
try:
logging.info("Creating a constructor for the student_portal class")
def __init__ (self, student_id1, student_password1):
logging.info("Creating private variables inside the constructor for student_portal1 class")
self.__student_id1 = student_id1
self.__student_password1 = student_password1
except Exception as e:
logging.exception(e)
print(e)
sp1 = student_portal1(1004, "password123")
print(sp1._student_portal1__student_id1)
print(sp1._student_portal1__student_password1)
logging.info(sp1._student_portal1__student_id1)
logging.info(sp1._student_portal1__student_password1)
# Example 10
class hackathon1:
logging.info("This is a class called hackathon1")
try:
def __init__ (self, team_name1, no_of_team_members1, project_title1):
logging.info("Creating private variables inside the constructor for hackathon1 class")
self.__team_name1 = team_name1
self.__no_of_team_members1 = no_of_team_members1
self.__project_title1 = project_title1
except Exception as e:
logging.exception(e)
print(e)
hat1 = hackathon1("Dashers", 5, "This is a project title")
print(hat1._hackathon1__team_name1)
print(hat1._hackathon1__no_of_team_members1)
print(hat1._hackathon1__project_title1)
logging.info(hat1._hackathon1__team_name1)
logging.info(hat1._hackathon1__no_of_team_members1)
logging.info(hat1._hackathon1__project_title1)