#员工信息管理系统(Employee Manage System )
#欢迎界面
print('='*50)
print('\t\t\t'+'Employee Manage System'+'\t')
print('\t\t\t\t'+'Welcome!'+'\t\t')
print('\t\t\t'+'1.seek employee '+'\t')
print('\t\t\t'+'2.add employee'+'\t')
print('\t\t\t'+'3.delete employee'+'\t')
print('\t\t\t'+'4.All of employees'+'\t')
print('\t\t\t'+'5.quit'+'\t')
print('='*50)
employees = [['孙悟空','男','花果山'],['猪八戒','男','高老庄'],['沙和尚','男','流沙河'],['唐三藏','男','东土大唐']]
while True:
s = input('What can I do for you?') #判断输入是否合法
if s.isdigit():
choose = int(s)
if choose == 1: #part 1
print('-'*50)
num = len(employees)
name = input('Please enter employee\'s name:')
flag = 0
for i in range(0,num):
if name in employees[i]:
print('\t\t\t'+'*'*40+'\t')
print('\t\t\t'+' num\t name\t sex\t address'+'\t')
print('\t\t\t',i+1,'\t',employees[i][0],'\t',employees[i][1],'\t',employees[i][2],'\t')
print('\t\t\t'+'*'*40+'\t')
flag = 1
break
else:
continue
if flag == 0:
print('He or she is not here.')
elif choose == 2: #part 2
print('-'*80)
person = [0,0,0]
employees.append(person) #用append增添列表新成员
person[0] = input('Please enter employee\'s name:')
person[1] = input('Please enter employee\'s sex:')
person[2] = input('Please enter employee\'s address:')
print('Add employee successfully!')
elif choose == 3: #part 3
print('-'*80)
num = len(employees)
name = input('Please enter his or her name:')
flag = 0
for i in range(0,num):
if name in employees[i]:
del employees[i]
print('Delete employee successfully!')
flag = 1
break
else:
continue
if flag == 0:
print('He or she is not here.')
elif choose == 4: #part 4
print('-'*80)
print('\t'+'All of employees:'+'\t')
num = len(employees)
for i in range(0,num):
print('\t\t\t'+'*'*40+'\t')
print('\t\t\t'+' num\t name\t sex\t address'+'\t')
print('\t\t\t',i+1,'\t',employees[i][0],'\t',employees[i][1],'\t',employees[i][2],'\t')
print('\t\t\t'+'*'*40+'\t')
elif choose == 5: #part 5
input('Enter to quit...') #点击回车退出
break
else:
print('input error! Please enter 1-5!')
print('-'*80)
else:
print('input error! Please enter 1-5!')