# CodeWars

To prepare myself for Makers Academy I’ve been trying to use a variety of tools that are at my disposal. I’ve been keeping myself as up to speed with git and GitHub as possible by regularly modifying my portfolio page and push my new commits to the repository. GitHub is a version control system that allows different people to work on the same projects while tracking the changes that have been implemented in the code each time files are “uploaded”.

As not to let my actual coding progress stutter I’ve been in regular attendance at CodeWars. CodeWars allows you to attempt all sorts of coding challenges from beginner coder through to expert. The challenges are known as Kata and are all user submitted. Once you have ranked up (known as kyu) you are allowed to create your own Kata for others to try, I must admit that I haven’t gotten round to doing this yet. If as I am, you are a complete programming novice you most likely wont have a clue what’s going on when you first tackle CodeWars. However if you persevere you’ll start to understand what’s going on. Each Kata will essentially ask you to define a function that will solve the required problem. Below is an example of an 8kyu (the starting/lowest rank) problem along with my (probably inefficient) answer.

#### QUESTION:

Given a set of numbers, return the additive inverse of each. Each positive becomes negatives, and the negatives become positives.

``#Using invert on the following should return: invert([1,2,3,4,5]) #=> [-1,-2,-3,-4,-5] invert([1,-2,3,-4,5]) #=> [-1,2,-3,4,-5] invert([]) #=> []``

You can assume that all values are integers.

#### SOLUTION:

``def invert(list)    list.map { |n| n *= -1 } end``

The 8kyu and 7kyu kata generally tackle the manipulation of strings and arrays while 6kyu (the rank I’ve reached so far) starts to deal with increasingly more intricate problems. Anyway I’ve found it to be a really useful resource in my learning and I hope it will help you too. It’s been great for learning all of the different methods available to me. For example I have regularly completed a kata using a variety of if/else statements, only to submit my code and realise when looking at other’s solutions that there’s a method that would have allowed me to complete it on one line!