# Programming Languages Used in AI-For-Beginners: Python and JavaScript Guide

> Explore the programming languages in AI-For-Beginners. Discover how Python powers AI lessons and JavaScript with Vue.js drives interactive quizzes, making AI accessible and engaging for everyone.

- Repository: [Microsoft/AI-For-Beginners](https://github.com/microsoft/AI-For-Beginners)
- Tags: tutorial
- Published: 2026-07-03

---

**The Microsoft AI-For-Beginners curriculum relies primarily on Python for all artificial intelligence lessons and machine learning implementations, while using JavaScript with Vue.js for the interactive quiz application that validates learner progress.**

The microsoft/AI-For-Beginners repository is a comprehensive educational resource designed to teach AI fundamentals through hands-on coding. While the core machine learning content is implemented in Python, the repository also incorporates JavaScript to deliver an interactive web-based quiz experience.

## Python: The Core Language for AI Lessons

All AI-focused lessons, Jupyter notebooks, and standalone executable examples in the repository are written in **Python**. The curriculum demonstrates machine learning concepts through both pure Python implementations and industry-standard deep learning frameworks.

### Pure Python Implementations

The repository includes minimal Python scripts that illustrate core AI mechanics without external dependencies. In [`examples/01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/01-hello-ai-world.py), a simple gradient descent algorithm is implemented using only the Python standard library:

```python
import random

class SimpleAILearner:
    def __init__(self):
        self.weight = random.uniform(0, 5)   # initial guess

        self.learning_rate = 0.01

    def predict(self, x):
        return self.weight * x

    def train(self, training_data, epochs=100):
        for epoch in range(epochs):
            for x, y_true in training_data:
                y_pred = self.predict(x)
                error = y_true - y_pred
                # simple gradient‑descent update

                self.weight += self.learning_rate * error * x

# -------------------------------------------------

# Example usage (also in examples/01-hello-ai-world.py)

if __name__ == "__main__":
    data = [(1, 2), (2, 4), (3, 6), (4, 8), (5, 10)]
    ai = SimpleAILearner()
    ai.train(data, epochs=100)
    print(f"Learned weight ≈ {ai.weight:.2f}")   # should approach 2.0

```

This script demonstrates the mechanics of training without requiring TensorFlow or PyTorch, making it accessible for absolute beginners.

### Deep Learning Frameworks: PyTorch and TensorFlow

The curriculum provides dual implementations for major deep learning concepts. In `lessons/3-NeuralNetworks/05-Frameworks/IntroPyTorch.ipynb`, learners work with **PyTorch** to build neural networks, while `lessons/5-NLP/18-Transformers/TransformersTF.ipynb` implements Transformer models using **TensorFlow**. The [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) file specifies the Python package dependencies required to run these notebooks, including both frameworks alongside Keras and other scientific computing libraries.

## JavaScript and Vue.js: The Interactive Quiz Application

While Python handles the AI instruction, **JavaScript** powers the supplementary quiz application located in `etc/quiz-app/`. This is a **Vue.js 2** single-page application that provides interactive knowledge assessments for learners.

The root component in [`etc/quiz-app/src/App.vue`](https://github.com/microsoft/AI-For-Beginners/blob/main/etc/quiz-app/src/App.vue) handles application routing and layout, while the quiz logic resides in [`etc/quiz-app/src/components/Quiz.vue`](https://github.com/microsoft/AI-For-Beginners/blob/main/etc/quiz-app/src/components/Quiz.vue). This component manages question state, answer validation, and scoring:

```vue
<template>
  <section class="quiz">
    <h2>{{ title }}</h2>
    <div v-if="!finished">
      <p v-html="currentQuestion.question"></p>
      <ul>
        <li v-for="(opt, idx) in currentQuestion.options" :key="idx">
          <label>
            <input type="radio" :value="opt" v-model="selected" />
            {{ opt }}
          </label>
        </li>
      </ul>
      <button @click="submitAnswer">Submit</button>
    </div>
    <div v-else>
      <p>Score: {{ score }} / {{ questions.length }}</p>
    </div>
  </section>
</template>

<script>
export default {
  name: "Quiz",
  props: { title: String, questions: Array },
  data() {
    return {
      index: 0,
      selected: null,
      score: 0,
      finished: false,
    };
  },
  computed: {
    currentQuestion() {
      return this.questions[this.index];
    },
  },
  methods: {
    submitAnswer() {
      if (this.selected === this.currentQuestion.answer) this.score++;
      this.selected = null;
      if (this.index + 1 < this.questions.length) this.index++;
      else this.finished = true;
    },
  },
};
</script>

<style scoped>
.quiz { max-width: 600px; margin: auto; }
</style>

```

This Vue component demonstrates modern JavaScript patterns including reactive state management, computed properties, and event handling.

## Key Files and Implementation Details

The repository structure reveals clear separation between educational content and supporting tools:

- **[`examples/01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/01-hello-ai-world.py)** – Pure Python implementation demonstrating basic gradient descent without external ML libraries.
- **`lessons/3-NeuralNetworks/05-Frameworks/IntroPyTorch.ipynb`** – Python notebook implementing neural networks with PyTorch.
- **`lessons/5-NLP/18-Transformers/TransformersTF.ipynb`** – Python notebook demonstrating Transformer architectures using TensorFlow.
- **[`etc/quiz-app/src/App.vue`](https://github.com/microsoft/AI-For-Beginners/blob/main/etc/quiz-app/src/App.vue)** – JavaScript entry point for the Vue.js quiz application.
- **[`etc/quiz-app/src/components/Quiz.vue`](https://github.com/microsoft/AI-For-Beginners/blob/main/etc/quiz-app/src/components/Quiz.vue)** – JavaScript component containing quiz logic and UI interactions.
- **[`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml)** – YAML configuration specifying Python dependencies including TensorFlow, PyTorch, and Keras.

## Summary

- **Python** serves as the primary programming language for all AI lessons, examples, and machine learning implementations in the AI-For-Beginners curriculum.
- The repository provides both **TensorFlow** and **PyTorch** implementations for deep learning concepts, alongside pure Python examples that require no external ML frameworks.
- **JavaScript** with **Vue.js 2** powers the interactive quiz application located in `etc/quiz-app/`, providing knowledge assessment capabilities.
- Key entry points include [`examples/01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/01-hello-ai-world.py) for basic AI concepts and [`etc/quiz-app/src/App.vue`](https://github.com/microsoft/AI-For-Beginners/blob/main/etc/quiz-app/src/App.vue) for the quiz interface.

## Frequently Asked Questions

### Does AI-For-Beginners use only Python for machine learning?

No, while Python is the primary language for all machine learning content, the curriculum specifically provides implementations using both **TensorFlow** and **PyTorch** frameworks. Additionally, pure Python examples in files like [`examples/01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/01-hello-ai-world.py) demonstrate AI concepts without any external dependencies, helping learners understand underlying mechanics before using high-level libraries.

### What JavaScript framework does the AI-For-Beginners quiz app use?

The quiz application uses **Vue.js 2** (Vue 2), a progressive JavaScript framework for building user interfaces. The application is structured as a single-page app with components located in `etc/quiz-app/src/components/`, including the core [`Quiz.vue`](https://github.com/microsoft/AI-For-Beginners/blob/main/Quiz.vue) component that handles question navigation and scoring logic.

### Are there any programming language prerequisites for AI-For-Beginners?

Learners should have basic familiarity with **Python** syntax to follow the machine learning lessons effectively, as all AI implementations are written in Python. For the quiz application, knowledge of **JavaScript** and Vue.js is not required to use the curriculum, though the source code is available for those interested in the web implementation.

### Does the repository include examples without TensorFlow or PyTorch?

Yes, the repository includes [`examples/01-hello-ai-world.py`](https://github.com/microsoft/AI-For-Beginners/blob/main/examples/01-hello-ai-world.py), which implements a simple gradient descent algorithm using only the Python standard library. This allows beginners to understand fundamental AI training mechanics—including weight updates and error calculation—before introducing the complexity of deep learning frameworks.