Skip to content

stewartsum/test-assessment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Coding Assessment

Introduction

The goal of the assessment is to allow you to demonstrate basic coding knowledge using modern Python 3. The version of Python used to perform and test the assertion checks was 3.11.5. Your system installation of Python should be at least version 3.10.

You are free to use the code editor of your choice to implement your solution to the coding exercises. PyCharm is popular and is slightly easier to use than other IDEs. VS Code is also another popular option. Please attempt the assessment on your own without using human or AI assistance. Internet search engines are fine otherwise.

Setup

First clone the GitHub repository to your local machine and do all your work from the main branch. Remember to commit your work and push back to your repository when done.

Make sure you have a Python 3 installation of at least version 3.10 on your computer.

Install the modules/packages listed in the requirements.txt file by running pip install -r requirements.txt in a terminal.

The Project Structure

The assessment is divided into two sections:

  1. Functions
  2. Data Exploration

There are two folders, functions and data_exploration in the project root folder corresponding to the two sections described earlier.

Functions

There are four Python files in the functions folder, two module files count_vowels.py and reverse_string.py and their corresponding unit test files, test_count_vowels.py and test_reverse_string.py.

Count Vowels

The file count_vowels.py contains a function stub shown below:

def count_vowels(string: str) -> dict[str, int]:
    # Replace the next line with your implemention
    raise NotImplementedError()

Implement the function using the sample input/output hint.

Input Output
"education" {"a": 1, "e": 1, "i": 1, "o": 1, "u": 1}
"able does it" {"a": 1, "e": 2, "i": 1, "o": 1, "u": 0}
"" {"a": 0, "e": 0, "i": 0, "o": 0, "u": 0}

Test your solution by running the unit test test_count_vowels.py from your IDE or the command line by running python -m unittest -v functions.test_count_vowels

Reverse String

The file reverse_string.py contains a function stub shown below:

def reverse_string(string: str) -> str:
    # Replace the next line with your implemention
    raise NotImplementedError()

Implement the function using the sample input/output hint.

Sample Input and Output

Input Output
"madam" "madam"
"" ""
"123.456" "654.321"

Test your solution by running the unit test test_reverse_string.py from your IDE or the command line by running python -m unittest -v functions.test_reverse_string

Data Exploration

There are three files in the data_exploration folder, students.py with its corresponding unit test file test_students.py and a CSV file students.csv.

There is a function stub shown below for you to implement.

def get_students_by_female_with_score_greater_than_90(
    students: pd.DataFrame,
) -> pd.DataFrame:
    # Replace the next line with your implemention
    raise NotImplementedError()

Run the test_students.py from your IDE or the command line by running python -m unittest -v data_exploration.test_students

Final Reminder

As a final check, you can run all the tests at once by running python -m unittest -v functions.test_count_vowels functions.test_reverse_string data_exploration.test_students from the command line.

Ensure all tests pass or as many tests pass to your satisfaction before committing and push your work.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages