CYF Docs
  • Welcome to CodeYourFuture Docs
  • CodeYourFuture Curriculum
  • 🏨Organisation
    • Our History
    • Agreements & Policies
      • Naming Accounts Consistently
      • Code of Conduct
      • House Rules
      • Trainee Forms
        • Personal Circumstances Forms
        • Course Withdrawal Request
        • Leave of Absence Request
        • Learner Agreement
      • Trainee Expenses
      • Trainee Pregnancy Policy
      • Volunteer Agreement
      • Volunteer Expenses
      • Complaints Procedure
    • Partnerships
  • 👨‍🎓Trainees and Alumni
    • Overview
    • Course Eligibility
    • Basic Online Skills Course
      • WhatsApp Community Guidelines
    • CYF Products
      • Our Products
    • Trainee Support
      • Signpost
      • Request a Laptop
      • How to get a bank account
      • Minimum Laptop Specs
      • Trainee Expenses
  • 👩‍🏫Volunteers
    • Overview
    • Teams
      • Tech Education
        • Roles
          • Lead Trainer
          • Technical Assistant
          • Tech Buddy
          • Syllabus Team
      • Professional Development
        • Roles
          • PD Trainer
          • PD Coach
          • PD Coursework Reviewer
          • PD Mock Interviewer
          • PD Syllabus Team
        • PD Coach Guide
      • Community Coordination
        • Outreach Roles
        • Social Media Guide
          • Plan and schedule Social Media
        • Applicant Outreach
          • Calling NGOs and other referral organisations
            • NGO Dashboard - Step by step guide for volunteers
          • Calling Applicants
          • More outreach strategy
        • Volunteer Outreach
        • Approaching Potential Partners
        • Energisers and Icebreakers
      • Employability
        • Regional Employability Role
        • Career Mentors
      • CYF Products/Launch Module
        • Roles
          • Product Owner
          • Product Manager (Launch Module)
          • Scrum Master
          • Tech Lead
          • Tech Lead (Launch Module)
          • Developer
          • Code Reviewer
          • QA
          • UI/UX Designer
          • Business Owner (Lauch Module)
          • DevOps Engineer
  • 🚀PROGRAMME DELIVERY
    • Running the Course
    • 🌍Launching the community in a new region
      • Fundraising & budgeting
      • Finding a Space
  • Archive
    • 🗄️Archived Pages
      • Intro to Digital (ITD)
        • Re-application Requirements for Application rejection
      • After Graduation
      • Running the course
      • Getting a Job
      • Useful Links
      • Hackathons
      • Asking Questions
      • Hosting on Netlify
      • Applicant Interviews
        • Interview - Technical
        • Interview - English
        • Interview - Rubric
      • Selection Day
      • Google Classroom for Trainees
      • Google Classroom
        • Google Classroom For Volunteers
      • Re-admission to Course
      • Laptop Request
      • Requesting a Laptop or Support
      • Graduation Module
      • Join CYF Tech Products
      • Overview
      • PD Coursework Reviewer
      • PD Coach
      • Onboarding PD Volunteers
      • CYF Website
      • Mission, Values & Working Principles
      • Our Trainees Backgrounds
      • Onboarding Process
      • Dashboard
      • Joining
      • Overview
      • Tools
        • Slack
          • Slack for Volunteers
          • Slack for Trainees
      • Leaving or Stepping Back
      • After the Course
        • From Trainee to Volunteer
      • General Information
      • Overview of our Process
        • Outreach Process
        • Application Process
        • Student Selection Process
        • Volunteering Structure
        • Class Structure
        • Communication from each CYF branch with CYF Global
        • Tech Projects
        • Tech Suite
        • Marketing
        • People into Employment
        • Finances and Insurance
      • The Founders team challenge
        • Challenge 1 - Find the Founding team
        • Challenge 2 - Strategy Challenge
          • The strategy challenge Template
        • Challenge 3: Find the Ambassador team
      • The Ambassadors Challenge
      • Volunteers Requirements
      • Welcome Event
      • The first Ambassador Team
      • Intro to Digital Course
        • Course Materials
        • Intro To Digital Slack Community Guidelines
      • Fundamentals Course
        • Course Materials
      • Software Development Course
        • Course Materials
      • Guides
        • Node Version Manager
        • Common Responses
          • Create an example
          • Don't ask to ask
          • Read the error message
          • Reply in thread
      • Coursework Feedback
      • Training Tips
      • Starting a Course
      • Getting Setup
      • Hackathons
      • Codility
      • Study Groups
      • Before the Course
        • Course Eligibility
      • Request a Laptop or Other Support
      • Success Criteria
      • Joining the Course
        • Laptops
          • Installing Ubuntu
      • Assessment
        • Milestones
      • Codewars
        • Codewars Advice from CYFers
        • Codewars Advice from Mentors
Powered by GitBook
On this page
  • Setup Codewars
  • 1. Sign Up
  • 2. Setup Account
  • 3. Join Our Clan
  • 4. Join the Slack Channel
  • CodeYourFuture Collections
  • How To Use Kata
  • 1. Read the description
  • 2. Read the tests
  • 3. Read the test results
  • 4. Refactor
  • 5. Compare
  • Recap

Was this helpful?

  1. Archive
  2. Archived Pages

Codewars

PreviousMilestonesNextCodewars Advice from CYFers

Last updated 4 months ago

Was this helpful?

is a site that has thousands of programming problems you can use to practice what you’ve learned in class.

On Codewars these problems are called Kata. A Kata is a little workout. Solving lots of kata gives you lots of practice in:

  • writing JavaScript 💻

  • breaking down problems 🧩

  • recognising common questions 🕵️‍♀️

  • building up your JavaScript muscles 💪

Setup Codewars

1. Sign Up

To sign up to Codewars visit this link and complete their simple tutorial

2. Setup Account

After you've signed in you'll want to go to "Account Settings" at the top right of the screen.

3. Join Our Clan

Codewars Clans are teams so that we can track how many challenges we've completed compared to other people. It also helps us share our solutions when we've completed them.

To join the CodeYourFuture clan you should enter "CodeYourFuture" as you see in the screenshot below

Make sure you scroll to the bottom of the page and click "Update" to save.

4. Join the Slack Channel

We've got a community of other CYF Trainees also working on Codewars exercises. You can find them at

Join the channel now!

CodeYourFuture Collections

We’ve made collections of kata and synced them to the Syllabus.

Here are the CYF collections:

To edit these collections, use the pinned thread in #cyf-codewars channel.

How To Use Kata

Choose a collection by clicking the title. You will see the collection view. If you click the green button marked ‘Train Now’, you’ll cycle through all the kata in this collection. Or you can go right to one you find interesting by clicking the title.

The first thing you’ll see is the details page - it will describe the problem. Sometimes these descriptions are very clear, but more often you will have to figure out what the kata wants by progressively working through with tests. And that’s what we want you to do.

You can read the description before you go into the kata to decide if you want to attempt it.

1. Read the description

Okay, so this one wants us to calculate the number of milliseconds given in hours, minutes and seconds.

What else does this kata description give us? They don’t all give you the same things, but here are some common clues you might get.

Input constraints / limits of each value

They are saying that there aren’t 61 minutes, or 135 minutes in an hour, or a million hours in a day. We don’t need to handle those kinds of values in this kata. We can be sure it’s always going to follow the rules of the 24 hour clock.

And here it gives us a test case -- here are inputs (h, m, s) and outputs (result) given. Let’s go into the kata by hitting Train.

2. Read the tests

And look, we can see the same values over here, in the tests panel.

The tests are showing inputs on the left and the expected output on the right. It’s saying the return value of the function past(), when given those inputs, must be equal to the value given after the comma.

The function past(0,1,1) must return the value 61000 for the test to pass.

So we could copy these answers into our code and just give the right outputs for the right inputs. We could even delete these other tests.

And look, green! But, would that solve the kata? No. If we change the inputs then the answers will be wrong. And the kata will do that for you. If you hit the blue “Attempt” button, it will run through loads more tests and look, now our answer doesn’t work any more.

So we can’t rewrite the tests to pass the code. We’ve got to rewrite the code to pass the tests.

Let’s work this problem

3. Read the test results

So I will reset by hitting the reset button and run the kata tests again.

Now my test is failing as undefined, because I’m not returning anything at all right now. I definitely need to return a value, so I’m going to write a return in. What other piece of information do I need?

  1. I need to figure out how many milliseconds there are in each of these values

  2. Convert the values to that number

  3. Then add them together.

How many milliseconds are there in an hour, anyway? I’m gonna google that.

Oh look at that - google has a converter right there. Wow, that’s a big number! I’m going to copy and paste that and then hit test. Test often.

Hm, not right yet -- I guess I need to try doing the same thing for the minutes and the seconds and then adding them all together.

Oh look, success! But this is only a limited number of tests.

I’ll hit the blue attempt button (you can attempt over and over, and you should).

4. Refactor

Now I’ve passed all my tests I can refactor and make it all tidy. Maybe I’ll make it a fat arrow function…

But look, it seems like I’ve solved this kata before so I’ve got my old solutions right here in this tab. What did I say?

That’s a pretty good point. I could one line this, and if I am practising one liners that is what I should do. But when I come back to this kata, I’m not convinced that I would know what these numbers mean. I wouldn’t know what 3.6e+6 meant, for sure. So maybe I should identify these values. I could do it the way I did last time, except I would spell milliseconds correctly. Hit submit.

5. Compare

And now we get to go and see how other people solved it. Click around the different filters. Look at all these different answers!

Ignore the “best practices” votes. The people voting are just learning and they don't know what best practices are. You will not write good code if you copy the best practices solutions on Codewars. But it’s interesting to see all the different ways to approach the problem - and there are always many many solutions.

(It’s worth repeating kata after a break - go back and train again on kata you’ve already done, a few weeks or months later and see how differently you approach things.)

Recap

So you need to:

  • Read the description

  • Run the tests

  • Read the test output

  • Google well and often

  • Test and test again

  • Refactor at the end

  • Read others solutions

on Slack

First, click this

Input constraints
A test case shows inputs and expected result

So that’s Codewars. . Join the slack channel. Find the collections, and get some exercise.

Clan name: CodeYourFuture Slack Channel: #cyf-codewars Collections: Further reading...

🗄️
#cyf-codewars
https://www.codewars.com/users/CodeYourFuture/authored_collections
link to view all of the CodeYourFuture collections.
Join the CodeYourFuture clan
CYF Modules
Codewars
https://www.codewars.com/join
curriculum/solving-coding-challenges.md at main · Techtonica/curriculumGitHub
coursebook/index.md at main · foundersandcoders/coursebookGitHub
HYF Study Book
Incremental coding
Logo
Logo