Skip to content

micanipho/Python-assessment-001

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Python-assessment-001

Welcome to your Python practical assessment! This challenge is designed to test your understanding of Python fundamentals, including variables, strings, lists, loops, and dictionaries.

πŸ“‚ File Structure

You should have the following two files in your folder:

  1. assessment.py - (EDIT THIS FILE)
    • This is where you will write your solutions.
    • Look for the # TODO comments inside the functions.
  2. test_assessment.py - (DO NOT EDIT)
    • This file contains the automated tests that grade your work.
    • Do not modify this file, or the tests may break!

πŸš€ How to Start

  1. Open assessment.py in your code editor (VS Code, Pycharm, etc.).
  2. You will see empty functions with pass inside them.
  3. Read the Docstring (the text inside """ """) to understand what the function needs to do.
  4. Replace pass with your own Python code.

πŸ§ͺ How to Run the Tests

To check if your code is correct, you need to run the test file, not the assessment file.

Step 1: Open your Terminal

Make sure your terminal/command prompt is pointing to the folder where these files are saved.

Step 2: Run the command

Type the following command and hit Enter:

python test_assessment.py

πŸ“Š Understanding the Output

If you see FAILED or Error:

Python will tell you exactly which test failed.

  • Example: FAIL: test_cube_number

  • Action: Go back to assessment.py, check your cube_number function, fix the logic, and run the test command again.

If you see OK:

Congratulations! All your functions are correct.

πŸ“ The Tasks

You need to complete the following functions:

  • cube_number: Return a number raised to the power of 3.

  • check_even_or_odd: Use modulo to determine parity.

  • combine_names: Format strings into "Last, First".

  • get_last_item: Retrieve the last item of a list using negative indexing.

  • sum_all_numbers: Calculate the total of a list of numbers.

  • get_country_code: Retrieve values from a dictionary using a key.

Good luck! 🐍

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages