Ai Coding Tools

How to Use GitHub Copilot to Write Your First Python Script in 2 Hours

By BTW Team3 min read

How to Use GitHub Copilot to Write Your First Python Script in 2026

If you're a beginner looking to dive into Python scripting, the prospect can feel daunting. You might wonder where to start or how to avoid the common pitfalls. What if I told you that you could leverage AI to help you write your first Python script in just two hours? Enter GitHub Copilot, an AI-powered coding assistant that can significantly speed up your development process.

In this guide, I'll walk you through the steps to use GitHub Copilot effectively, share my experiences, and offer practical advice on what you can realistically expect.

Prerequisites: What You Need Before Starting

Before you jump into coding, make sure you have the following:

  • A GitHub account: You’ll need this to access Copilot.
  • Visual Studio Code (VS Code): This is the code editor where you'll be writing your script. Download it from here.
  • GitHub Copilot subscription: As of June 2026, Copilot costs $10/month after a free trial. You can sign up for it here.
  • Basic understanding of Python: Familiarity with variables, loops, and functions will help, but Copilot can guide you through most of it.

Step 1: Setting Up GitHub Copilot in VS Code

  1. Install VS Code: If you haven't already, download and install Visual Studio Code.
  2. Install the GitHub Copilot extension: Open VS Code, go to Extensions (Ctrl+Shift+X), and search for "GitHub Copilot". Click to install.
  3. Sign in to GitHub: After installation, you'll need to sign in to your GitHub account to activate the extension.

Expected Output: You should see a Copilot icon in the VS Code sidebar, indicating that it’s ready to assist you.

Step 2: Starting Your First Python Script

  1. Create a new file: In VS Code, create a new file and save it with a .py extension (e.g., my_first_script.py).
  2. Write a comment to describe what you want to do: For example, type # Create a simple calculator at the top of your file.
  3. Invoke Copilot: Start typing your function or logic, and Copilot will suggest completions. For instance, type def add(a, b): and wait for Copilot to suggest the function body.

Expected Output: You should see a suggested function that adds two numbers.

Step 3: Completing Your Script

Continue writing your script by defining other functions like subtraction, multiplication, and division. Use comments to guide Copilot on what you want next. For example:

# Create a function for subtraction
def subtract(a, b):

Expected Output: Copilot should suggest a function that performs subtraction.

Troubleshooting: What Could Go Wrong

  1. Copilot doesn’t suggest anything: Make sure you’re connected to the internet and that you have an active Copilot subscription.
  2. Suggestions don’t make sense: Sometimes Copilot might miss the mark. Don’t hesitate to edit the code it suggests or write your own. It’s not perfect, but it’s a great starting point.

What's Next: Expanding Your Skills

Once you've completed your first script, here are some paths to consider:

  • Explore Python libraries: Look into libraries like Pandas and NumPy for data manipulation.
  • Build a small project: Try creating a simple web app using Flask or a command-line tool.
  • Learn about Git and version control: This will help you manage your projects better.

Conclusion: Start Here

Using GitHub Copilot can significantly reduce the time it takes to write your first Python script. With a solid setup and some basic Python knowledge, you can have a functional script in just two hours. Remember, it's okay to edit Copilot's suggestions. The goal is to learn and grow as a coder.

If you're ready to get started, follow the steps outlined above and don't forget to experiment. Happy coding!

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time As a developer, whether you're just starting out or have years of experience, debugging can feel like a neverend

Oct 16, 20265 min read
Ai Coding Tools

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow As developers, we’re always on the lookout for ways to streamline our workflow and boost productivity. Enter

Oct 14, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools That Could Hurt Your Development Process

5 Myths About AI Coding Tools That Could Hurt Your Development Process As a solo founder or indie hacker, you might be lured by the promises of AI coding tools that claim to simpli

Oct 13, 20264 min read
Ai Coding Tools

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026 As AI coding tools have become an integral part of a developer's toolkit in 2026, many are still stumbling over

Oct 12, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026 As we dive into 2026, the landscape of AI coding tools has evolved significantly, yet many developers still

Oct 11, 20263 min read
Ai Coding Tools

Why AI Coding Assistants Are Overrated for Beginners in 2026

Why AI Coding Assistants Are Overrated for Beginners in 2026 As a solo founder or indie hacker, it’s tempting to think that AI coding assistants are the silver bullet to jumpstart

Oct 10, 20263 min read