|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": 11, |
| 5 | + "execution_count": 16, |
6 | 6 | "metadata": {}, |
7 | 7 | "outputs": [ |
8 | 8 | { |
9 | 9 | "name": "stdout", |
10 | 10 | "output_type": "stream", |
11 | 11 | "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", |
13 | 17 | "Soumyadip Chowdhury [email protected] 100000\n" |
14 | 18 | ] |
15 | 19 | } |
16 | 20 | ], |
17 | 21 | "source": [ |
18 | 22 | "class Employee:\n", |
19 | 23 | " \n", |
20 | | - " raise_ammount=1.04\n", |
| 24 | + " raise_amount=1.04\n", |
21 | 25 | " \n", |
22 | 26 | " def __init__(self,f ,l ,p ):\n", |
23 | 27 | " self.first=f\n", |
|
29 | 33 | " return \"{} {} {} {}\".format(self.first,self.last,self.email,self.pay)\n", |
30 | 34 | " \n", |
31 | 35 | " 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", |
33 | 37 | " ## Can print using class,self and obj name \n", |
34 | 38 | " \n", |
35 | 39 | "emp_1=Employee(\"Soumyadip\",\"Chowdhury\",900000)\n", |
36 | 40 | "emp_2=Employee(\"Soumyadip\",\"Chowdhury\",100000)\n", |
| 41 | + "\n", |
37 | 42 | "print(Employee.raise_amount)\n", |
38 | 43 | "print(emp_1.raise_amount)\n", |
39 | 44 | "print(emp_2.raise_amount)\n", |
40 | | - "emp_1.apply_raise()\n", |
41 | 45 | "\n", |
42 | 46 | "\n", |
| 47 | + "print(Employee.__dict__)\n", |
| 48 | + "\n", |
43 | 49 | "print(emp_1.print())\n", |
44 | 50 | "print(emp_2.print())" |
45 | 51 | ] |
|
0 commit comments