The company ACME offers their employees the flexibility to work the hours they want. But due to some external circumstances they need to know what employees have been at the office within the same time frame
The goal of this exercise is to output a table containing pairs of employees and how often they have coincided in the office.
Input: the name of an employee and the schedule they worked, indicating the time and hours. This should be a .txt file with at least five sets of data.
The solution consist of a single function called read_file using Python as development language. The function recieves as input the path of the .txt file and returns the pairs of employees and how often they have coincided in the office.
For simplicity, the architecture the solution consists of only two files: index.py where the solution is located and test.py where the unit tests are located. Addiotionally, there is a folder called files where the sample .txt files used for both the solution and the tests are located.
The solution was developed with Python because due the variety of native function and packages that make it easy to read files. While reading the file, native string methods were used to decompose each line and compare it to the next for matches. If there is a match, a counter is incremented and finally and string with the required format and number of matches is built.
- Clone the repositorie to your local computer
- Once cloned, go to the path ioet-jr-excercise
- Run the script with the command py index.py or python index.py
- After running the command, the solution will be executed and you will see the output in console.
- Clone the repositorie to your local computer
- Once cloned, go to the path ioet-jr-excercise
- Run the script with the command py -m unittest test.py
- After running the command, the tests will be executed and you would see the output of the script and the output of the tests in console.
Note: In the index.py script, the file used by default is example.txt. If you want to try it with another file, you can change the variable files_dir in the .py script