Skip to content

BATorres/ioet-jr-excercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IOET JR DEVELOPER EXCERCISE

Problem

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.

Solution

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.

Architecture

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.

Aproach

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.

Instructions

1. Run the script

  • 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.

2. Run the tests

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages