Ai Coding Tools

How to Use GitHub Copilot to Write Your First Code in Under 2 Hours

By BTW Team3 min read

How to Use GitHub Copilot to Write Your First Code in Under 2 Hours

If you're a beginner looking to dive into coding but feel overwhelmed by the complexity, you're not alone. Many aspiring developers struggle to find the right tools and guidance to get started. Enter GitHub Copilot: an AI-powered coding assistant that promises to simplify the coding experience. In this guide, I'll show you how to leverage GitHub Copilot to write your first piece of code in under two hours.

Prerequisites: What You Need Before You Start

Before you dive in, make sure you have the following:

  1. A GitHub Account: Sign up for free at GitHub.
  2. Visual Studio Code: Download and install it from Visual Studio Code.
  3. GitHub Copilot Subscription: GitHub Copilot is priced at $10/month or $100/year after a free trial period of 30 days.

Step 1: Setting Up GitHub Copilot

  1. Install Visual Studio Code: If you haven't already, install Visual Studio Code on your machine.
  2. Install GitHub Copilot:
    • Open Visual Studio Code.
    • Navigate to the extensions view by clicking on the Extensions icon or pressing Ctrl+Shift+X.
    • Search for "GitHub Copilot" and click "Install".
  3. Authenticate Your GitHub Account: Once installed, you'll need to log in with your GitHub account to activate Copilot.

Expected Output: You should see a Copilot icon in the bottom right corner of your VS Code window.

Step 2: Writing Your First Code

Let’s write a simple “Hello World” program in Python.

  1. Create a New File: Open a new file and save it as hello.py.
  2. Start Typing: Type print( and pause. GitHub Copilot will suggest completing the line.
  3. Accept the Suggestion: Press Tab to accept the suggestion. Your code should look like this:
    print("Hello, World!")
    
  4. Run Your Code: Open a terminal in VS Code and run your code using:
    python hello.py
    

Expected Output: You should see Hello, World! printed in the terminal.

Step 3: Experimenting with More Complex Code

Now let's create a simple function to add two numbers.

  1. Define a Function: Start typing def add_numbers(a, b): and wait for Copilot to suggest the function body.
  2. Accept the Suggestion: It may suggest a return statement. Accept it.
  3. Call the Function: Below the function, type print(add_numbers(5, 7)) and accept the suggestion.

Expected Output: When you run the file again, you should see 12 printed in the terminal.

Troubleshooting: What Could Go Wrong

  • Copilot Doesn't Suggest Anything: Ensure you're connected to the internet and logged into GitHub.
  • Code Doesn't Run: Double-check for syntax errors. Python is sensitive to indentation.
  • Functionality Limitations: Copilot may not always suggest the most efficient code. Always review the suggestions.

What’s Next: Expanding Your Knowledge

Now that you’ve written your first code, consider exploring more complex projects. Here are some ideas:

  • Build a simple calculator.
  • Create a to-do list application.
  • Explore web development with Flask or Django.

Conclusion: Start Here

Using GitHub Copilot can significantly speed up your coding journey, especially for beginners. In just under two hours, you can write your first lines of code and gain confidence in your coding skills.

If you’re looking to become more proficient, keep experimenting with Copilot and gradually tackle more complex projects.

What We Actually Use

In our experience, GitHub Copilot is a must-have for any beginner coder, but we also recommend checking out Replit for collaborative coding and Codecademy for structured learning paths.

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

Why GitHub Copilot is Overrated: Contrarian Perspectives on AI Coding Assistants

Why GitHub Copilot is Overrated: Contrarian Perspectives on AI Coding Assistants As a solo founder or indie hacker, you’re always on the lookout for tools that genuinely boost your

Mar 16, 20264 min read
Ai Coding Tools

How to Build Your First App Using AI Tools in Under 3 Hours

How to Build Your First App Using AI Tools in Under 3 Hours If you're a solo founder or an indie hacker, the thought of building an app might seem daunting. But what if I told you

Mar 16, 20265 min read
Ai Coding Tools

Top 5 AI Tools for Beginners in 2026: Your Launchpad

Top 5 AI Tools for Beginners in 2026: Your Launchpad As a beginner diving into the world of coding in 2026, the landscape is flooded with AI tools promising to make your journey sm

Mar 16, 20264 min read
Ai Coding Tools

Supabase vs Firebase for AI-Driven Projects: A 2026 Comparison

Supabase vs Firebase for AIDriven Projects: A 2026 Comparison As we dive into 2026, the landscape for building AIdriven applications has evolved significantly. If you're an indie h

Mar 16, 20264 min read
Ai Coding Tools

How to Build a Simple App with GitHub Copilot in 2 Hours

How to Build a Simple App with GitHub Copilot in 2026 Building an app can feel like a daunting task, especially if you’re a beginner. You might be asking yourself if you have the r

Mar 16, 20264 min read
Ai Coding Tools

How to Write Code 3x Faster Using AI in Just 30 Minutes

How to Write Code 3x Faster Using AI in Just 30 Minutes As a solo founder or indie hacker, you're probably familiar with the struggle of balancing coding with everything else on yo

Mar 16, 20265 min read