Use a basic list structure to enhance Functionality 1 that you developed in Week 1. You should allow users to enter information for five employees at the same time, where the first employee information entry is saved in index [0] and the second entry is saved in index [1], and so on. You want to make sure to enforce the user to enter the following employee information: employeeName, employeeSSN, employeePhone, employeeEmail, employeeSalary. After the user finishes entering the last employee information, they should get a message to allow them to print specific employee information from the saved list. The user can enter values between 1 and 5, where 1 will return the employee information saved in the list index [0], 2 will return the employee information saved in the list index [1] and so on. The printed result should be in the following format:

Mike Smith, 123123,(111)222-3333,mikeemail,$6000

Respuesta :

Answer:

Python code is given below

Explanation:

# Create an empty  list

employees = []

for i in range(5):

   print('Enter information for employee number ' + str(i + 1) + ':')

#entering the employee details as input

   name = input('Enter employee name: ')

   ssn = input('Enter employee SSN: ')

   number = input('Enter employee number: ')

   email = input('Enter employee email: ')

   salary = input('Enter employee salary: ')

   employees.append([name, ssn, number, email, salary])

index = int(input('Enter value from 1-5 to print employee information and 0 to exit:'))

while index != 0:

   employee = employees[index - 1]

   print(employee[0] + ', ' + employee[1] + ', ' + employee[2] + ', ' + employee[3] + ',

+ employee[4])

   print()

   index = int(input('Enter value from 1-5 to print employee information and 0 to exit:'))