How to master writing code fast with spaced repetition and Anki?
Spaced repetition and Anki can help you to learn any programming language quickly and permanently. If you put in 10 minutes each day, you can become the fastest programmer around, easing your work and shine at coding job interviews.
If you don’t know spaced repetition and Anki yet, have a look at this great article: Level Up Your Learning with Anki and Spaced Repetition.
Just to clarify the terms, spaced repetition is a learning technique that is often used with flashcards and Anki is an open-source flashcards application for desktop and mobile.
There are many guides on spaced repetition and Anki, and therefore, this article will focus specifically on how to create flashcards with written code answers. For an example see the three screenshots below.
The steps to setup Anki for written code answers are as following:
- Download the latest desktop version for Anki for Windows or Mac from: https://apps.ankiweb.net/
- Open Anki and create a deck
- Create your first card
- Setup card format
How to Learn Cards
On the main screen select the deck you want to practice.
Type your answer and confirm with the “Enter” key:
Rate you answer with the key “1” if the answer was wrong and “Enter” if the answer was correct.
Each card should be as simple as possible
An overly complex card would be:
This card practices two problems at the same time: first, how to subset the column ‘weight’ and second, how to get the ‘minimum’ and ‘median’. A better solution would be to split the card in two cards.
Do not mix typed and not typed answers in one deck
Create separate decks with typed answers, for instance, to practice python data manipulation create a deck specifically for that. To practice, for instance coding theory and edge cases, create another deck with a ‘basic’ card format or even use another app.
The benefit is that this will help you focus on practicing a specific skill. Switching too much between concepts (e.g. programming languages, type of answers, …) will drain you more quickly and will slow down your learning process.
How to have multi line answers?
Download and install the extension “Multi-Line Type Answer Box”.
Confirm answers with the hotkey “Ctrl” + “Enter” instead of “Enter”.
font-family: monospace !important;
How to display tables?
Download and install the extension “Add Table”.
To create dummy tables, for instance in python, you can create a data frame and print it as markdown table. The “Add Table” extension in Anki can convert the markdown tables to display them on the card.