Skip to content

Commit 63c4d82

Browse files
committed
Raise Am
1 parent 1f8d6f6 commit 63c4d82

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

Employee Class Variable.ipynb

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 16,
5+
"execution_count": 11,
66
"metadata": {},
77
"outputs": [
88
{
99
"name": "stdout",
1010
"output_type": "stream",
1111
"text": [
12-
"Soumyadip Chowdhury [email protected] 900000\n",
13-
"Soumyadip Chowdhury [email protected] 100000\n",
14-
"Soumyadip Chowdhury [email protected] 900000\n",
12+
"Soumyadip Chowdhury [email protected] 936000\n",
1513
"Soumyadip Chowdhury [email protected] 100000\n"
1614
]
1715
}
1816
],
1917
"source": [
2018
"class Employee:\n",
2119
" \n",
20+
" raise_ammount=1.04\n",
21+
" \n",
2222
" def __init__(self,f ,l ,p ):\n",
2323
" self.first=f\n",
2424
" self.last=l\n",
@@ -27,15 +27,29 @@
2727
" \n",
2828
" def print(self):\n",
2929
" return \"{} {} {} {}\".format(self.first,self.last,self.email,self.pay)\n",
30-
" \n",
31-
" \n",
30+
" \n",
31+
" def apply_raise(self):\n",
32+
" self.pay=int(self.pay* self.raise_ammount)\n",
33+
" ## Can print using class,self and obj name \n",
34+
" \n",
3235
"emp_1=Employee(\"Soumyadip\",\"Chowdhury\",900000)\n",
3336
"emp_2=Employee(\"Soumyadip\",\"Chowdhury\",100000)\n",
37+
"print(Employee.raise_amount)\n",
38+
"print(emp_1.raise_amount)\n",
39+
"print(emp_2.raise_amount)\n",
40+
"emp_1.apply_raise()\n",
41+
"\n",
42+
"\n",
3443
"print(emp_1.print())\n",
35-
"print(emp_2.print())\n",
36-
"print(Employee.print(emp_1))\n",
37-
"print(Employee.print(emp_2))"
44+
"print(emp_2.print())"
3845
]
46+
},
47+
{
48+
"cell_type": "code",
49+
"execution_count": null,
50+
"metadata": {},
51+
"outputs": [],
52+
"source": []
3953
}
4054
],
4155
"metadata": {

0 commit comments

Comments
 (0)