Question: #Import the random module #create a dictionary called payroll _ entry inside a function. Name your function create _ payroll _ entry. You need to
#Import the random module
#create a dictionary called payrollentry inside a function. Name your function "createpayrollentry". You need to return the dictionary.
#This dictionary will contain no values, only keys so for every value, you will want to code an empty string. For example: key:
#Your dictionary should contain main keys employeeid: 'payrolldetails: 'employeeinfo': 'department': 'bankinfo':
#The FIRST key "employeeid is like any other key value pair, so list the key and the empty string as the value.
#The keys IN ORDER" payrolldetails, employeeinfo, department, bankinfo, will all contain other dictionaires as values For example: key: key: 'value', 'key': 'value'
#'payrolldetails': dictionary keys are salary and payrate both with empty strings as values
#'employeeinfo': dictionary keys are firstname, middleinitial, lastname, streetaddress, city, state, zip, position all with empty strings as values
#'department': dictionary keys are departmentname, location, all with empty strings as values
#'bankinfo': dictionary keys are accountnumber, routingnumber all with empty strings as values
#The above instructions might look like the following structure. You will replace "key" with the appropriate key:
#Function Declaration USE THE FOLLOWING DICTIONARY STRUCTURE. Your first key is employeeid with the empty string as the value. Adjust for more or less number of keyvalue pairs where needed.
payrollentry
'userid:
'key': key: 'key':
'key': key: 'key': 'key':
'key': key: 'key': 'key':
'key': key: 'key': 'key': 'key':
'key': key: 'key':
#Return Statement RETURN THE DICTIONARY HERE.
#After creating your dictionary function, Define a parameterized funtion called "getemployeeinfo", you can simply use 'employees' as your parameter.
#Inside your new function:
# Inside the 'getemployeeinfo' function:
# Print a message to prompt the payroll clerk to create a new employee account.
# Generate a random digit number userid between and
# Convert the generated random number to a string and assign it to the 'employeeid key in the 'employees' dictionary.
# Iterate through each keyvalue pair in the 'employees' dictionary using a loop.
# For each key in the dictionary:
#Check if the key is not equal to 'employeeid
#If it's not 'employeeid print the key as a category eg 'payrolldetails', 'department'
# For each subkey within the current category:
#Prompt the user for input related to that subkey eg if the category is 'payrolldetails', prompt for 'salary' or 'payrate' You'll need a conditional here salry or payrate?
# Update the corresponding subkey in the 'employees' dictionary with the payroll clerk's input.
# Repeat steps for each key and subkey combination in the dictionary.
# After collecting all employee information, return the 'employees' dictionary from the 'getemployeeinfo function.
# Call the createpayrollentry function.
# Store the returned dictionary in a variable, such as 'newemployee'.
# Call the getemployeeinfo function passing as an argument your "newemployee" dictionary reference
# printnewemployee
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
