In: Computer Science
Apex Computing is preparing for a Secret Santa gift exchange. Certain information will be gathered from each employee. Although it would be more realistic to write a program that asks a user for input, this program will just be a practice for using structures and functions so we will create the information by assigning values to the variables.
Write a program that uses a structure named EmpInfo to store the following about each employee:
Name
Age
Favorite Food
Favorite Color
The program should create three EmpInfo variables, store values in their members, and pass each one, in turn, to a function that displays the information in a clear and easy-to-read format. (Remember that you will choose the information for the variables.)
Here is an example of the output:
Name………………………………Mary Smith
Age ……………………………….. 25
Favorite food ………………… Pizza
Favorite color ……………….. Green
class EmpInfo:
def __init__(self, name, age,food,color):
self.name = name
self.age = age
self.food = food
self.color = color
def printInfo(empData):
print("\n\nName........................"+empData.name)
print("Age........................."+empData.age)
print("Favorite food..............."+empData.food)
print("Favorite color.............."+empData.color)
empList = []
for i in range(3):
print("Enter employee "+str(i+1)+" details")
name=input("Name:")
age=input("Age:")
food=input("Favorite food:")
color=input("Favorite color:")
empList.append(EmpInfo(name,age,food,color))
for i in range(len(empList)):
printInfo(empList[i])

