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

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