Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SA.:Phase 3 Code Challenge: Python Fundamentals

  1. Create a repository on your GitHub account.
  2. Use Python to wire down the solution.
  3. Push the solution to the above repository once done.
  4. Submit the repository link for grading.
  5. Ensure your repository has a well written README.

By {List of contributors}

This project was created and is sole property of Annglorious mueni.

Python Coding Assessment

Instructions:

  • This assessment is designed to evaluate your understanding of fundamental Python concepts.
  • You are required to complete the tasks outlined below within the specified time frame.
  • Ensure your code adheres to Python syntax and best practices.
  • Write comments to explain your code where necessary.
  • Create a well-written README file providing instructions on repository setup and running the application in the terminal.
  • Create a new PRIVATE repository, and push your solutions to it.

Topics Covered:

  1. Basic data structures
  2. Functions
  3. Decorators
  4. Sequences
  5. Sets, Dictionaries
  6. Object-Oriented Programming

Tasks:

  • Function: add_numbers (2 points) Write a Python function named add_numbers that takes two parameters num1 and num2, and returns the sum of the two numbers.

  • Function: is_even (2 points) Write a Python function named is_even that takes a single parameter number and returns True if the number is even, and False otherwise.

  • Function: reverse_string (2 points) Write a Python function named reverse_string that takes a string text as input and returns the reversed version of that string.

  • Function: count_vowels (2 points) Write a Python function named count_vowels that takes a string text as input and returns the count of vowels (a, e, i, o, u) in the string. Ignore case sensitivity.

  • Function: calculate_factorial (2 points) Write a Python function named calculate_factorial that takes a non-negative integer n as input and returns the factorial of that number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n.

  • Function: apply_decorator (1 point) Write a Python function named apply_decorator that takes a function func as input and applies a decorator named decorator_func. The decorator should simply print "Decorator Applied" before calling the original function.

  • Sequences: Sort List of Tuples (1 point) Given a list of tuples where each tuple contains a name and an age, write a Python function named sort_by_age that sorts the list of tuples by age in ascending order.

  • Sets and Dictionaries: Merge Dictionaries (1 point) Write a Python function named merge_dicts that takes two dictionaries as input and merges them into a single dictionary. If there are any common keys, their values should be summed up.

  • Object-Oriented Programming: Class Creation (2 points) Define a Python class named Car with the following attributes: make, model, year. Implement a method named display_info that prints out the car's information.

Setup/Installation Requirements

  • One would need either linux or wsl for window users
  • A copy of visual basic code installed
  • A github account
  1. Open your terminal and go to the directory you wish to work from.
  2. Go to the following url using ur github account https://github.com/ANNGLORIOUS/phase3-code-1
  3. Go to the code tab and clone the ssh key
  4. Go back to the termina and type git clone <-followed by the ssh key you copied /cloned ->
  5. Enter your new cloned repository and type in code .
  6. On the visual studio code that has now opened, go to the the run tab and hit start debugging.

Technologies Used

This program is built purely with python using the visual code environment.

Support and contact details

For any issues please email me at annglorious.mueni@student.moringaschool.com

License

Apache License 2.0

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages