Ai Coding Tools

How to Use AI Tools to Write Your First Python Program in 2 Hours

By BTW Team4 min read

How to Use AI Tools to Write Your First Python Program in 2 Hours

Feeling overwhelmed by the prospect of writing your first Python program? You're not alone. Many aspiring coders get stuck in the endless loop of tutorials and documentation, unsure where to start. In 2026, AI tools have made it easier than ever to break through that barrier and actually write code. In this guide, I’ll show you how to leverage AI tools to write your first Python program in just 2 hours.

Prerequisites: What You Need to Get Started

Before diving in, here’s what you’ll need:

  1. A Computer: Any machine that can run Python will do.
  2. Python Installed: Download the latest version here.
  3. An AI Tool: We’ll look at several options below, such as GitHub Copilot or OpenAI's Codex.
  4. A Code Editor: Visual Studio Code or PyCharm are both solid choices.

Step 1: Choose Your AI Tool

Let’s explore some AI tools that can assist you in writing Python code. Knowing what each tool does, its pricing, and its limitations will help you make the right choice.

AI Tools Overview

| Tool | What It Does | Pricing | Best For | Limitations | Our Take | |----------------------|---------------------------------------------|------------------------------|------------------------------|------------------------------------------|--------------------------------------------| | GitHub Copilot | AI-powered code completion for various languages | $10/mo, no free tier | Beginners looking for guidance | Can suggest incorrect code | We use this for quick code suggestions. | | OpenAI Codex | Natural language to code conversion | $0-100/mo based on usage | Building small scripts | Usage limits can add up | Great for generating snippets quickly. | | Replit | Collaborative online IDE with AI support | Free tier + $20/mo pro | Beginners and team projects | Limited features in free tier | We like it for collaborative projects. | | Tabnine | AI code completion for multiple languages | Free tier + $12/mo pro | Individual developers | Less robust than Copilot | Good for simple auto-completions. | | Codeium | Free AI-powered code completion | Free | Students and hobbyists | Fewer advanced features | Excellent for those on a budget. | | Sourcery | AI-powered code review and suggestions | Free tier + $15/mo pro | Developers wanting to refactor | Limited to Python only | We don’t use this much personally. |

What We Actually Use

In our experience, GitHub Copilot is the most effective tool for beginners, while OpenAI Codex is excellent for translating ideas into code quickly.

Step 2: Define Your Project

Before you start writing code, decide on a simple project. A common choice for beginners is a basic calculator that can add, subtract, multiply, and divide. This project is straightforward and will give you a chance to use various Python concepts.

Step 3: Generate Code with AI

Now that you have your project defined, let’s use an AI tool to generate some code. Here’s a step-by-step process:

  1. Open your code editor and create a new Python file (e.g., calculator.py).
  2. Start with a comment that describes what you want to build. For example:
    # A simple calculator that can add, subtract, multiply, and divide.
    
  3. Use your AI tool to generate functions. For example, in GitHub Copilot, start typing:
    def add(x, y):
    
    The AI will suggest the rest of the code.
  4. Repeat for other operations (subtract, multiply, divide).
  5. Implement user input to allow users to choose an operation and enter numbers.

Expected Output

After generating the code, your calculator.py might look something like this:

def add(x, y):
    return x + y

def subtract(x, y):
    return x - y

def multiply(x, y):
    return x * y

def divide(x, y):
    return x / y

print("Select operation:")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")

choice = input("Enter choice (1/2/3/4): ")
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))

if choice == '1':
    print(num1, "+", num2, "=", add(num1, num2))
# Add similar conditions for other operations

Troubleshooting: What Could Go Wrong

  1. AI Suggestions: Sometimes the AI might suggest incorrect syntax. Don’t hesitate to modify it.
  2. Errors: If your program throws an error, read the traceback carefully. It often tells you where you went wrong.

What’s Next?

Once you’ve built your calculator, consider expanding it by adding features like error handling, user-friendly messages, or even a graphical interface using libraries like Tkinter.

Conclusion: Start Here

If you're just starting out, I recommend beginning with GitHub Copilot for its intuitive suggestions. Follow the steps outlined above, and you’ll have your first Python program running in no time. Remember, the key is to experiment and not get discouraged by mistakes; every coder has been there.

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

Supabase vs Firebase: Which AI Database is Best for Solo Developers in 2026?

Supabase vs Firebase: Which AI Database is Best for Solo Developers in 2026? As a solo developer, choosing the right database solution can feel like navigating a minefield. You wan

Jun 23, 20264 min read
Ai Coding Tools

How to Create an AI-Powered Chatbot in Under 2 Hours

How to Create an AIPowered Chatbot in Under 2 Hours Building an AIpowered chatbot might sound like a daunting task, especially if you're a solo founder or side project builder with

Jun 23, 20264 min read
Ai Coding Tools

Cursor vs GitHub Copilot: Which AI Tool is the Coding Future?

Cursor vs GitHub Copilot: Which AI Tool is the Coding Future? In 2026, the landscape of coding tools has evolved dramatically, and the competition between AI assistants is fiercer

Jun 23, 20264 min read
Ai Coding Tools

5 Best AI Coding Tools for Beginners to Learn Programming in 2026

5 Best AI Coding Tools for Beginners to Learn Programming in 2026 If you’re a beginner looking to dive into programming in 2026, the right tools can make all the difference. The la

Jun 23, 20264 min read
Ai Coding Tools

Cursor vs GitHub Copilot: AI Coding Tools Compared

Cursor vs GitHub Copilot: AI Coding Tools Compared As a solo developer, finding the right AI coding tool can feel like navigating a minefield. You want something that genuinely enh

Jun 23, 20264 min read
Ai Coding Tools

How to Use GitHub Copilot to Write Code 50% Faster in Just 2 Weeks

How to Use GitHub Copilot to Write Code 50% Faster in Just 2 Weeks As a solo founder or indie hacker, time is your most precious resource. If you're coding, you probably wish for a

Jun 23, 20264 min read