You may have attended a course or read a book. You have taken the first brave and important step in learning how to code: you have learnt the fundamentals.
Hopefully you have learnt them well and have a good grasp of the key concepts. Perhaps you have attended one of the brilliant CodeToday courses, and if not, what are you waiting for?
You can now look at some code someone else wrote and you know where to start in terms of understanding it and tweaking it.
But what about starting with a blank page and an idea of something you want to code? You open the programming environment you learnt to use in your course, you place your fingers in the I’m-reading-to-start-typing-at-1000-words-per-minute-speed pose, hovering just an inch or so over your keyboard…
…and you freeze in that position for a few long seconds. You decide to go and make a coffee instead (after all you heard how the definition of programming is the act of turning coffee into code, so maybe that’s what’s missing)
Speaking Spanish
Many may have a relationship with a language similar to what I have with Spanish: give me some text and I’ll probably understand a fair amount of it, but ask we to speak or write in Spanish and… nothing, zilch, nada (sorry, couldn’t resist).
Beginners to programming are often in exactly the same situation. They can read and follow code that uses methods and techniques that they have learnt, and it all makes perfect sense to them. It may even give them that false sense of overconfidence, a belief that programming is easy, after all.
But going from understanding code to writing code requires a further step. This can be summarised in just three words:
Practise, practise and practise
The question is: how? You can come up with some ideas of your own and try to code them. But what if you can’t come up with great ideas?
This is where websites such as www.codewars.com come in. [There are others, but I’ll focus just on this one in this post]
Introduction to Codewars
Codewars provides a large repertoire of challenges (called kata, inspired from martial arts terminology) in which a short description introduces the task and the required inputs and outputs are explained. Your job is to write code that fulfils the kata’s demands.
Once you’ve written a draft of your code you can check the output of some tests through the web interface and if you pass all the tests, you can submit your final version which will go through even more rigorous testing.
If you pass, great. You earn brownie points, or more specifically points that will get you through the ranks (called kyu - don’t ask, martial arts lingo, again). Progressing through the ranks of course means starting with easier kata and then moving on to harder ones.
The fun (and learning) doesn’t stop there, though. Once you have submitted a solution you can see other solutions submitted by other users. This is a very useful part of the process and should not be skipped. It will enable you to see alternative ideas and methods, and learn new Python tricks (or tricks in whatever language you happen to be coding in). Some solutions will be very obscure — don’t worry, just ignore the ones that seem as though they’re written in a different language. You’ll get there eventually.
Many kata will be in the form of functions that need a certain input and expect a certain output. Although www.codewars.com has a web interface in which you can code, my advise is to copy the code stub provided in the kata into your preferred IDE, such as PyCharm. Then write and test your code within your preferred coding environment and once you’re ready to try it out, copy and paste your function back in codewars. I have set up a codewars project in PyCharm where I keep all the kata I’ve attempted.
A few words of warning:
not all kata are interesting - do skip ones you can’t stand the sight of but don’t skip too many. Strange kata are the ones which will get you out of your comfort zone and hopefully lead to towards learning a method or trick you didn’t know before.
these types of challenges lend themselves best to a certain tasks that can be easily checked and verified using automatic tests. Typically the code you need to write will be enclosed within a function. This is great but it doesn’t cover every single aspect of programming and it generally doesn’t cover more complex programs. So use these tools as one of the ways of improving your skills, not the only one
The best way to find out more is to set up a free account at www.codewars.com and start training. Feel free to look for and join the CodeToday clan, and if you are one of our students then make sure you use our support package and discuss your kata with us through the shared folder set up when you attended our course.
Have fun coding, and see you on codewars…