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

How to Integrate AI Tools in Your Workflow in Just 30 Minutes

How to Integrate AI Tools in Your Workflow in Just 30 Minutes As a solo founder or indie hacker, you’re always on the lookout for ways to enhance productivity without wasting preci

May 1, 20265 min read
Ai Coding Tools

Bolt.new vs Codeium: Which AI Tool Can Deliver Your MVP Faster?

Bolt.new vs Codeium: Which AI Tool Can Deliver Your MVP Faster? (2026) As indie hackers and solo founders, we often find ourselves in a race against time. The goal? Get that Minimu

May 1, 20263 min read
Ai Coding Tools

10 AI Coding Tools That Will Revolutionize Your Workflow in 2026

10 AI Coding Tools That Will Revolutionize Your Workflow in 2026 As we dive into 2026, the landscape of software development has dramatically shifted thanks to AI coding tools. If

May 1, 20265 min read
Ai Coding Tools

How to Build a Simple Game with AI Tools in Just 3 Days

How to Build a Simple Game with AI Tools in Just 3 Days Building a game can feel like an overwhelming task, especially for beginners. With so many moving parts—from graphics and so

May 1, 20264 min read
Ai Coding Tools

Cursor vs GitHub Copilot: A Deep Dive Comparison in 2026

Cursor vs GitHub Copilot: A Deep Dive Comparison in 2026 As a solo founder or indie hacker, choosing the right AI coding tool can feel like a daunting task. With so many options, i

May 1, 20264 min read
Ai Coding Tools

10 Common Mistakes in Using AI Coding Tools and How to Avoid Them

10 Common Mistakes in Using AI Coding Tools and How to Avoid Them As a solo founder or indie hacker in 2026, you're likely exploring AI coding tools to speed up your development pr

May 1, 20264 min read