Skip to content

Commit 318c43a

Browse files
committed
__Dict__
1 parent 63c4d82 commit 318c43a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Employee Class Variable.ipynb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 11,
5+
"execution_count": 16,
66
"metadata": {},
77
"outputs": [
88
{
99
"name": "stdout",
1010
"output_type": "stream",
1111
"text": [
12-
"Soumyadip Chowdhury [email protected] 936000\n",
12+
"1.04\n",
13+
"1.04\n",
14+
"1.04\n",
15+
"{'__module__': '__main__', 'raise_amount': 1.04, '__init__': <function Employee.__init__ at 0x0000024613529288>, 'print': <function Employee.print at 0x0000024613529798>, 'apply_raise': <function Employee.apply_raise at 0x0000024613529708>, '__dict__': <attribute '__dict__' of 'Employee' objects>, '__weakref__': <attribute '__weakref__' of 'Employee' objects>, '__doc__': None}\n",
16+
"Soumyadip Chowdhury [email protected] 900000\n",
1317
"Soumyadip Chowdhury [email protected] 100000\n"
1418
]
1519
}
1620
],
1721
"source": [
1822
"class Employee:\n",
1923
" \n",
20-
" raise_ammount=1.04\n",
24+
" raise_amount=1.04\n",
2125
" \n",
2226
" def __init__(self,f ,l ,p ):\n",
2327
" self.first=f\n",
@@ -29,17 +33,19 @@
2933
" return \"{} {} {} {}\".format(self.first,self.last,self.email,self.pay)\n",
3034
" \n",
3135
" def apply_raise(self):\n",
32-
" self.pay=int(self.pay* self.raise_ammount)\n",
36+
" self.pay=int(self.pay* self.raise_amount)\n",
3337
" ## Can print using class,self and obj name \n",
3438
" \n",
3539
"emp_1=Employee(\"Soumyadip\",\"Chowdhury\",900000)\n",
3640
"emp_2=Employee(\"Soumyadip\",\"Chowdhury\",100000)\n",
41+
"\n",
3742
"print(Employee.raise_amount)\n",
3843
"print(emp_1.raise_amount)\n",
3944
"print(emp_2.raise_amount)\n",
40-
"emp_1.apply_raise()\n",
4145
"\n",
4246
"\n",
47+
"print(Employee.__dict__)\n",
48+
"\n",
4349
"print(emp_1.print())\n",
4450
"print(emp_2.print())"
4551
]

0 commit comments

Comments
 (0)