Manage Employee Details using Python

Create and Manage the employee details using python...

Concept:

create unique email id for each registered employee and access the data of employee's using employee id that is Add employee and View employee.
eg: VigneshwaranS1998@vtech.com ( employee id )

Input / Output:

1. Add Employee  2. View Employee
Enter option: 1
first name: Vigneshwaran
last name: S
dd-mm-yyyy: 31-12-1998

Do you want to continue press y/n: y

1. Add Employee  2. View Employee
Enter option: 2
Enter your employee id: VigneshwaranS1998@vtech.com
Firstname  : Vigneshwaran
Lastname   : S
DOB        : 31-12-1998
EmployeeID : VigneshwaranS1998@vtech.com

Program:

for python 3...

l = 'y'
f = open('emplis.txt','a')
f.write('************ Employee Detail list ********************\n')
lis = []
while l == 'y':
    
    print("""1. Add Employee  2. View Employee """)
    option = int(input("Enter option: "))


    if option == 1:

        f = open('emplis.txt','a')
        fn = input("first name: ")
        f.write('\nFirstname  : ' + fn)
        
        ln = input("last name: ")
        f.write('\nLastname   : ' + ln)

        dob = input("dd-mm-yyyy: ")
        f.write('\nDOB        : ' + dob)

        idf = fn+ln[0]+dob[6:]
        empid = idf + "@vtech.com"
        f.write('\nEmployeeID : ' + empid)
        f.write('\n')
        
        add = []
        add.append(fn)
        add.append(ln)
        add.append(dob)
        add.append(empid)

        lis.append(add)
        f.close()

        l='n'
        l = input("Do you want to continue press y/n: ")

    elif option == 2:
        eid = input("Enter your employee id: ")
        for i in range(len(lis)):
            if lis[i][-1] == eid:
                print("Firstname  : "+lis[i][0])
                print("Lastname   : "+lis[i][1])
                print("DOB        : "+lis[i][2])      
                print("EmployeeID : "+lis[i][-1])
                
        l='n'
        l = input("Do you want to continue press y/n: ")



------------------------------------------------------------------------------------------

Comments

Popular posts from this blog

Swap file using python

PyCon-India 2019

Addition Game using Python