How I’d Learn Python faster using AI
How I’d use ChatGPT, Gemini, and NotebookLM to learn Python.
This is an article written by me that was published on AI Supremacy some weeks ago. Today I’m making this article free for all of you.
If you’re new, subscribe to get weekly articles like this👇
Tools we know well like ChatGPT and Gemini can make learning to code easier and less frustrating. Also, less-known tools like NotebookLM are changing how we learn new subjects and coding is one of them.
In this article, we’ll explore how to make the most of these AI tools for learning to code. Since I often write about the Python programming language, I’ll use Python as an example. However, everything discussed here can be applied to other programming languages as well.
ChatGPT Canvas: Run and debug your code within ChatGPT
Canvas is a new interface for working with ChatGPT on writing and coding projects. Thanks to Canvas, now you can use ChatGPT as if it was your AI code editor.
This is a feature that I’d definitely use if I had to learn Python again because it allows us to do many things within ChatGPT, such as running Python code, debugging code, and asking in-line feedback and suggestions.
To use Canvas, just ask ChatGPT to write a simple “Hello World” script, and then click on view tools and select “Canvas.” Once you press enter, you’ll see a panel on the right. That’s your Python environment where you can test your code. Just click on run every time you modify your code, and the results will be printed on the console below.
If you’re new to coding, things like installing Python, and setting up your code editor and environment might seem intimidating and frustrating at first. Fortunately, now you can skip these steps and focus on learning to code thanks to ChatGPT Canvas.
You can also import Python libraries using ChatGPT Canvas. In the example below, Canvas imports matplotlib and numpy to do a task common in data analysis, which is plotting visualizations. You can import many other libraries, but remember that there’s a limited number of libraries available.
Canvas has a button located in the bottom-right corner that displays many features useful for developers and software engineers. These features are:
Review code
Port to a language
Fix bugs
Add logs
Add comments to your code
Besides Canvas, it’s worth mentioning other ways to learn Python with ChatGPT. My favorite is brainstorming unique projects with ChatGPT. Why projects? It’s the best way to put the concepts you learned into practice.
We can use ChatGPT to come up with cool and unique project ideas based on the programming knowledge we have and the things we like.
Here’s the prompt I use for this.
Act as a programming mentor. I’m learning Python and have already learned [topic 1, topic 2, …]
What Python projects can I solve? Consider that I like [thing 1, thing 2, …]
Here’s an example.
Once you select a project, you can ask for the steps to solve it (without making ChatGPT write the code for you).
In a previous article, I covered other ways to use ChatGPT to learn Python. While some of those suggestions can now be accomplished with just one click using Canvas, others remain relevant.
Turn Gemini into your real-time AI tutor
Gemini is Google’s AI model. One cool feature of Gemini 2.0 is real-time screen sharing. This feature allows us to share our screens with Gemini, enabling it to analyze on-screen content and provide real-time assistance.
As programmers, we can allow Gemini 2.0 to view our screen and provide real-time guidance for solving any coding problem we encounter.
Anyone with a Google account can use this feature for free. To use it, go to this site, click on “stream realtime” on the left panel, and select “share screen.” After that, Gemini will see your screen and you can talk with it in real-time.
You can open your code editor, start writing code, and ask for guidance from Gemini whenever you need it. Here’s a demo where I asked Gemini for help to create a Python script that generates ten random numbers.
This is like having an AI tutor that can see whatever you’re working on 24/7. As a beginner, you can use Gemini to write a script, remember functions, learn terminal commands, set up your code environment, and more!
Improve the way you learn to code with NotebookLM
NotebookLM is an AI-powered research and note-taking tool developed by Google. You can use NotebookLM to:
Convert long documents (PDFs, slides, links) into easy-to-understand summaries
Build your own study guides effortlessly
Create a podcast where an AI host walks you through complex material in minutes
This is game-changing for learning new subjects. That’s why I think this tool will change the way you learn coding.
How do I use NotebookLM to learn Python? I use it to better understand any Python tutorial or guide I’m following and even go beyond that by asking questions about the content in the video or guide. To do this, go to NotebookLM, and then provide the link to a YouTube tutorial or Python guide, book, etc. Once you upload your file, NotebookLM will analyze its content and then we can start a chat with it.
In the example below, I gave NotebookLM a link to my tutorial on how to send emails with Python. Once it analyzed the video’s transcript, I could ask it questions like the libraries used in the video or what I should keep into account before writing the script to send emails with Python.
If you want to go beyond the tutorial, just generate a podcast from the document uploaded. To generate the podcast, just go to the Audio Overview section and click on Generate. After some minutes, NotebookLM will generate an engaging audio discussion between two AI-generated hosts. The discussion is a summary of the material with some extra information that will help you deep diver into the topic and even learn new things.
Here’s the podcast NotebookLM generated from my YouTube video.
I find the podcast a good complement to my video tutorial. While my video mostly focuses on the Python code to send the emails, the podcast dives into concepts such as SSL, SMTP, secure passwords, and more!
You can find another nice AI-generated podcast about my Python book recommendation, in this article.
GitHub Copilot: A general-purpose AI coding assistant
Here’s a bonus for those with some coding experience: GitHub Copilot.
GitHub's AI tool is a game-changer for real-time code writing. What's cool about it is that it offers an interaction style similar to ChatGPT, but it's focused on coding. Plus, it can keep building out a program you're working on in the editor.
One feature that really stands out to me is the chat function. You can literally quiz it about constructing functions or clear up any doubts about specific bits of your code. It's like having a coding guru on standby, ready to jump in with insights or solutions.
Something I like about Copilot is that it doesn't just stop after giving a response. It keeps the ball rolling, offering up possible questions I might want to ask next or things to consider. Below is how Copilot completed a Fibonacci function and the follow-up questions it generated.
It's like having an ongoing conversation with your code!
Plus, there's a feature that lets you move the suggested code into your editor. This creates a seamless flow, letting you bounce between the chat and the editor.
If you want to multitask within the editor, you can get the Copilot chat by pressing Ctrl + i.
Here are some of my favorite commands:
Diving deeper into the code:
/explain
Getting unstuck or fixing code snags:
/fix
Conducting tests on the code:
/tests
I have to say Copilot is one of my favorite tools. It's like having the best of ChatGPT, but baked right into your IDE, making coding effortless and more efficient. You can add the GitHub Copilot extension to Visual Studio Code, Visual Studio, JetBrains, and Neovim.
GitHub Copilot is my favorite general-purpose coding assistant, but other tools excel in specific scenarios. In this article, I reviewed all the AI coding assistants I tried.
Are you using any other AI tool to learn to code? Let me know in the comments!
Thank you for a most interesting article about using AI to assist learning Python code. In particular I noted your description of how to use Notebooks LM, something I am looking to use.
You asked for comment on experiences using AI in coding situations. I am renewing my interest in Linux, investigating various projects with Raspberry Pi computers. I haven't used Linux for well over a decade. While my usual environment is Apple (MacOS and iOS), I am enjoying getting back to a basic Unix environment. Deep into my retirement. I have tried various IDEs but have had unfortunate experiences with VSCode and VSCodium. My Raspberry Pis (400 and 5) are ARM64-based systems and neither of those two IDEs seems to like them! They might be a bit heavy for the 400, but not for the 5. There are solutions available for these problems, but I didn't fancy sweating over them. Instead, I have opted for Zed which is a new, very clean, uncluttered IDE that has an easy and tidy interface with several AI models. My preferred model is Gemini 2.5 Pro which gives me answers to my queries in a structure I appreciate and can follow easily. Getting solutions to problems is a breeze using an API. I found, working through examples, that the AI link very quickly found the examples I was using and offered me the text I was endeavouring to enter! For someone who has developed web apps in the past with thousands of lines of PHP code, now looking to use Python web coding, using Zed is a snap. I am looking forward to renewing my acquaintance with data science using Python.
I am also looking to use AI techniques with articles I am planning for my Substack.