Question
Hello, I need help modifying the code below. You will need to reorganize the functions into modules (separate files). Please include a screenshot of your
Hello, I need help modifying the code below. You will need to reorganize the functions into modules (separate files). Please include a screenshot of your code. Thank you.
# function to test employee_name
def checkname(employee_name):
if(employee_name.isalpha() == False):
exit()
return employee_name
# function to test employee_id
def checkid(employee_id):
if(len(employee_id) > 7):
exit()
else:
employee_id = int(employee_id)
return employee_id
# function to test email
def checkmail(employee_mail):
if(employee_mail.isalnum() == False):
employee_mail.replace('@', '')
employee_mail.replace('.','')
if(employee_mail.isalnum == False):
exit()
return employee_mail
Employee= dict() # empty dictionary
for loop5 in range(5): # loop for 5 iterations
# user id input
employee_id = input("Enter the employee ID: ")
# user name input
employee_name = input("Enter the employee name: ")
# user mail input
employee_mail = input("Enter the employee email: ")
#user address input
employee_address = input("Enter the employee address: ")
try:
# test employee address
if employee_address.isalnum() == False:
break
print("Hello, " + checkname(employee_name) + " Your employee ID is " + str(checkid(employee_id)) + " and your email address is " + checkmail(employee_mail) + " and your address is " + employee_address)
except:
# if address not provided
print("Hello, " + checkname(employee_name) + " Your employee ID is " + str(checkid(employee_id)) + " and your email address is " + checkmail(employee_mail) + " you did not provide an address.")
Employee[employee_id] = [employee_name, employee_mail, employee_address]
for key, value in Employee.items():
value.insert(0, key)
print(value) #print the whole list
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started