Answer :
Sure, I can help you with that! Below is the Python program that creates the desired dictionary and prompts the user to enter an employee number. It then displays the employee's name, job title, and salary based on the entered employee number:
```python
def main():
employees = {
1111: ["James Krieger", "Software Engineer", 110000],
2222: ["Christine Draper", "Director", 250000],
3333: ["Pablo Pascal", "Manager", 165000],
4444: ["Jacqueline Miller", "Software Engineer", 115000],
5555: ["Isabella Bautista", "Software Engineer", 120000]
}
try:
emp_number = int(input("Enter an employee number: "))
emp_info = employees.get(emp_number)
if emp_info:
print(f"Name: {emp_info[0]}, Job Title: {emp_info[1]}, Salary: {emp_info[2]}")
else:
print("Invalid employee number. Please try again.")
except ValueError:
print("Invalid input. Employee number must be an integer.")
if __name__ == "__main__":
main()
```
The provided Python program accomplishes the given task in a structured manner. It starts by defining the main function, which serves as the entry point for the program.
Inside the main function, we create a dictionary named `employees` that contains the employee numbers as keys and the corresponding employee information (name, job title, and salary) as values, stored in a list.
The program then prompts the user to enter an employee number using the `input()` function. It ensures that the input is an integer by using a `try-except` block and catching any `ValueError` that might occur if the user enters a non-integer value.
Next, the program uses the `get()` method to retrieve the employee information based on the entered employee number. If the employee number is found in the dictionary, the program prints the employee's name, job title, and salary in the specified format.
If the entered employee number is not found in the dictionary, an appropriate error message is displayed.
The use of `get()` method avoids raising a `KeyError` when an invalid employee number is entered and allows for a more graceful handling of the situation.
Learn more about Python program.
brainly.com/question/32674011
#SPJ11