forked from varisha-025/TCS-XPLORE-PYTHON-CODES
-
Notifications
You must be signed in to change notification settings - Fork 0
/
8_March_IRA_OrganisationLeave.py
49 lines (48 loc) · 1.17 KB
/
8_March_IRA_OrganisationLeave.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
class OrganisationLeave:
def __init__(self,name,des,salary,balance):
self.name=name
self.des=des
self.salary=salary
self.balance=balance
class Organisation:
def __init__(self,el):
self.el=el
def check(self,ng,leave,days):
for i in self.el:
if i.name.lower()==ng.lower():
for l,c in i.balance.items():
if l==leave and days<=c:
i.balance[l]-=days
return True
return False
if __name__=="__main__":
t=int(input())
el=[]
for i in range(t):
name=input()
des=input()
salary=int(input())
n=int(input())
balance={}
for j in range(n):
lt=input().upper()
nd=int(input())
balance[lt]=nd
el.append(OrganisationLeave(name,des,salary,balance))
ng=input()
leave=input().upper()
days=int(input())
ob=Organisation(el)
s=ob.check(ng,leave,days)
if s==True:
print('Leave granted.')
else:
print('Leave not granted.')
flag=0
for i in el:
if i.name.lower()==ng.lower():
flag=1
for j,h in i.balance.items():
print(j+':'+str(h))
if flag==0:
print('Employee not found.')