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

Top 5 Open-Source AI Coding Tools You Can Start Using Today

Top 5 OpenSource AI Coding Tools You Can Start Using Today In 2026, the landscape of coding has evolved dramatically, with AI tools becoming integral to the development process. As

Apr 12, 20264 min read
Ai Coding Tools

How to Write Your First 100 Lines of Code with AI Assistance in 1 Hour

How to Write Your First 100 Lines of Code with AI Assistance in 1 Hour If you're a beginner looking to dip your toes into coding, the thought of writing your first lines of code ca

Apr 12, 20264 min read
Ai Coding Tools

How to Efficiently Debug Code Using AI Tools within 60 Minutes

How to Efficiently Debug Code Using AI Tools within 60 Minutes Debugging code can feel like searching for a needle in a haystack, especially when you're under pressure to ship. In

Apr 12, 20264 min read
Ai Coding Tools

Why AI Coding Assistants Are Not Always the Best Option

Why AI Coding Assistants Are Not Always the Best Option As we dive deeper into 2026, the allure of AI coding assistants seems stronger than ever. They promise to streamline our cod

Apr 12, 20264 min read
Ai Coding Tools

The $100 AI Coding Toolkit: Best Budget Tools for Indie Developers

The $100 AI Coding Toolkit: Best Budget Tools for Indie Developers As an indie developer, you know how crucial it is to keep costs down while still leveraging powerful tools. With

Apr 12, 20265 min read
Ai Coding Tools

Why GitHub Copilot is Overrated: The Truth Behind the Buzz

Why GitHub Copilot is Overrated: The Truth Behind the Buzz In 2026, the buzz around AI coding tools like GitHub Copilot is louder than ever, but let’s be real: it's overrated. As i

Apr 12, 20264 min read