Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # simple fun:
- def department(dep):
- return 'department: ' + dep
- print(department('cse'))
- print(department('eee'))
- print(department('civil'))
- # example
- id = [60, 59, 58, 57]
- def depart(dep):
- return dep == 'cse' or dep == 'eee' or dep == 'civil' or dep == 'geb'
- def check_dep(dep):
- if depart(dep):
- print(dep)
- else:
- print('invalid')
- check_dep('cse')
- print('\n\n\n')
- def check_dep_by_id(code):
- index = id.index(code)
- if id[index] == 60:
- print('cse')
- elif id[index] == 59:
- print('eee')
- elif id[index] == 58:
- print('civil')
- elif id[index] == 57:
- print('geb')
- else:
- print('invalid')
- check_dep_by_id(59)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement