Repository with prompt and code for Module 1, Challenge 7: Employee Database.
The owner of a small business tried to write a Python program to manage his employees' information, but he has no idea what he's doing.
He hired a previous consultant to write tests for him, but after the consultant left, he couldn't figure out how to use those tests.
He hired you, another consultant, to just get things working.
Figure out what the requirements are by reading the tests. Get the tests to pass by fixing problems in employee_database.py
. Do not modify any code in test_employee_database.py
.
This challenge will test and give you practice in:
- How to read other peoples' code and fix it
- How to read the tests
- How to manually debug (not using a debugging tool)
- You don't necessarily need to know how every line in the tests works... just find out what results the tests check for.
- You can also manually test the program.
- There's more code than you're accustomed to, and some of it looks scary. Remember to just think things through and read the code carefully. Aside from
try/except
and the ternary statement, there's nothing in here you haven't seen before. - Look for comments and hints within the code.
- Conditionals
- Loops
- Nesting and Scope
- Dictionaries
- User Input
- Basic Testing
- Basic Debugging
- Make sure
pipenv
is installed. For a tutorial, see 0.3.4 - Pipenv and Python Package Management - Fork this repository to your own account.
- Clone the forked repository to your local computer.
- Run
pipenv install
to install the needed modules in a virtual environment. - Run
pipenv shell
to activate a virtual environment with the installed modules. Alternatively, you can runpipenv run [PROGRAM]
instead of the usualpython3 [PROGRAM]
command. - Inside
employee_database.py
, you will make your changes. You're welcome to look attest_employee_database.py
to see what's being tested and how. - While you're writing and/or when you're done, you can execute the provided tests to verify your program works by running
python3 test_employee_database.py
. All tests are passing if you seeOK
in the output. You can also manually test by directly runningpython3 employee_database.py
and inputing your own values.