Learning Programming? You should try Anki | Learning Intelligence 38

A programmer shows how he uses Anki flashcards to learn Python through spaced repetition, with cards covering concepts like lambda and range. He walks through his daily review routine, then debugs a pandas DataFrame assignment with his brother to show how the technique works in practice.
Chapters
Morning team! I just got up to page 50 in the new Python for Pandas— no, Python for Data Analysis book that I got the other day. And chapter 3 is on built-in data structures, functions, and files. But what I was doing this morning— it's been a little bit of a bit quieter than yesterday morning. Yesterday morning we kind of got up at sunrise and climbed a pier. You can see that post on my Instagram. That was pretty fun, but just been going through, through the book, not necessarily taking notes, just reading. I've got like a little bookmark here of something important that I want to come back to because someone reminded me the other day on my channel in one of the comments, have I been using Anki? Let me show you what that is. So, Anki is like a flashcard remembering system. It's a free piece of software. It's pretty basic. It's got some decks here from when I used to learn Japanese, used to learn Mandarin, done a bit of MySQL, PHP, and Python, which is what I'm most focused on now. I was learning too many things at the same time. If you want to learn something, really focus down on one thing. And so now I'm on Python all the way. Python through and through, baby. Hiss! And here come the Globo Gym Purple Cobras led by White Goodman, all business. So we go onto my Python deck and what it is, is it's smart flashcards. So this is a Python deck. So there's no new ones because I haven't used it in a while and I've got 100 to review. So I've got my work cut out for me. If I want to add something new, like for example, this little thing here in range, you can add a card there. So if we add it in, I'll just quickly show you what it looks like. So the front will be, the front will be like the front of the flashcard. Then the back, you won't be able to see until you try and answer the front. Just a little, a little statement so I can think about it in my head. And that will return. So we'll add that to the flashcard deck. You can press Command+Enter, that's a shortcut. And it's added. We'll go back to the deck and see how there's one new now because I've just, just added that card. And let's, let's study. What is lambda? Lambda is an anonymous function. Show example. So here down the bottom, you can see I haven't done it in a while, but if I need to, if I didn't get it right, I would press again because then it would ask me the same question within 10 minutes. If I found it hard, it will ask me again in 6.1 months because I've done this flashcard a few times, and if it's good, it'll last me 1.5 years, and if it was easy, it'll last me 3.3 years. And what does that mean in time spacing? So, the idea of Anki is if you're recording, say, Python functions, for example, and you're getting better and better and better at certain things, you don't want to be asked them every single day, otherwise you'll have a list of 1,000. I've got 100 I've got to go through before I'm back to zero. If you're getting really good at some, you don't want them to be asked for a long time. That's why you see that the 1.5-year timeframe there. And if you're, if you're not so good, you want to be re-asked that in a relatively short timeframe. So for example, say I just added in that List, Range 1, the first time I answer it, it will actually ask me twice within 10 minutes, and then the time will get longer and longer and longer. As I get better. So, I'd encourage you, if you want a really good way to— I don't know why I stopped doing it. I think it— because it was getting— I was— I think I was learning too many things at once. So, I'm going to reinstantiate my Python deck and get back into it after I've learned some new things. I forgot to mention, the idea of Anki is spaced repetition. So, if you do set it up, if you do set up a flashcard deck, try and do it every single day. I mean, that's what I'm going to be trying to do. I'll set a little reminder for myself to to go through my Python Anki flashcards every day. Because we want to be Python wizards, right? We want to be able to craft some programs and do some data analysis. But I think today we're studying some more data science, me and my bro. We might head over to the library or something. All right, scratch that. My brother's in a Fortnite tournament, so we're not going to the library. I'm going to jump into some stuff. I got stuck on assignment 2 last week, so I'm going to finish that off. And then once he's ready, we'll get back into it together. I hate the blue flashing light on my monitor at nighttime, so I always have to turn it off at the wall before I go to sleep. Okay Google, 25-minute timer. Sure, 25 minutes starting now. Okay Google, stop the timer. All right, 25-minute session. We're still stuck on, on assignment 2 on the same question. Made some progress. But I'm going to have to bounce to the forums and I'm going to take a 5-minute break, go for a walk in the backyard or something and let the subconscious solve the problem for me. Well, fingers crossed. We'll come back to it in a sec. I think I've got it. Throw the ball around, help me think about it. I love getting out into nature when I'm stuck on a problem because, because look at that, it's so simple but it's beautiful. Nature reminds me of how slow the world goes. When you think you're, you're stuck on something, you're trying to do it really fast, you're trying to get it done, come outside and you realize everything's still alright. Let's go solve this problem. Alright, I think I got it. So I had to sort a DataFrame from highest population to lowest population based on a whole lot of different parameters and eventually got out California, Texas, Illinois as my answer for question 6. So what did I have to do? I had to separate the states' counties into another DataFrame, create a list of the top 3 counties in each state by population, map each state's top 3 counties to the state name, sort the state and population dictionary in descending order, and then save out the top 3 states and put them in descending order. And return top 3 gives us these. Is it right? I don't know yet. Could it be done with less code? Probably. But my solution works so far. If you're stuck on something, take a break, because I came back and after a few more iterations, we got it done. On to question 7. Let's get some sunlight in here because you know why? I'm feeling good because I just passed Assignment 2 of the Applied Data Science course with Python. So I had 2 submissions, they both failed, 0 out of 100, 0 out of 100, and then I fixed up the errors. This one was a pretty big jump, so I made a heap of progress here, and then I fixed up the errors for 320 and got it submitted. Boo yeah, baby! You know what that means, we're on to Week 3. Let's go see my bro. Data science? Hell yeah! Oh yeah, baby! Oh, you gotta clean this room first. All right, we didn't make it to the library. What are you up to? Assignment 2. Oh, just what I finished. What's going on? Look at this error code. Yeah, I think it's because it could be a little intimidating seeing this massive error code. Look at that. When really it's only— go to the bottom— it's only a small thing. Unsupported operand type. It just means you can't use that with float and string. That's all right, I knew that. We'll work it out. Many hours later. Ready to submit, bro? Good luck, me. Codebook success submitted successfully. My submission. Oh baby, you passed it as well! 100 out of 100. How do you feel? It was difficult. Yeah, actually, we, we just spent the last, I don't know, 2 or so hours just going through the code from the top to bottom again, step by step, to, to try and get a bit more hours. Yeah, but we got it done. How you feel? Accomplished. On to the next week. Ah, scared of what week 3 holds. What's week 3? No, we got this, bro, we got this. Merging frames. Do you know what my catchphrase is? No. Keep learning. Keep hammering. Keep hammering. Whichever one you want to keep on doing. We'll see you next week.
More from Daniel

Small Language Models (SLMs) Are the Future: Fine-Tuning AI That Runs on Your iPhone

Introducing Sunny - A MedGemma-Powered Skin Health Tracking App (Kaggle Competition Entry)

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 4 - Comparing the results

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 3 - Running LLMs on the RTX 4090

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 2 - Formalizing the tests

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 1 - Creating a series of tests

Local Multimodal RAG on the NVIDIA DGX Spark | Part 4 - Publishing our demo to Hugging Face

Local Multimodal RAG on the NVIDIA DGX Spark | Part 3 - Putting it all together


