AI Logic School

Empowering Students with AI & Computational Thinking

Class 9 AI | Unit 5: Introduction to Python – The Language of AI

Unit 6: Introduction to Python

Mastering the World's Most Popular AI Programming Language

1. Why Python for AI?

Python was created by Guido van Rossum in 1991. Today, it is the #1 choice for AI because it is easy to read, just like English!

Simple Syntax

Python code is very short. To print a message, you just need one line, unlike Java or C++.

Massive Libraries

Python has ready-made "toolboxes" (Libraries) like NumPy, Pandas, and Scikit-learn specifically for AI.

2. Your First Python Script

Let's look at the basic "Hello World" program. In Python, it's as simple as this:

print("Hello, AI Logic School Students!")

3. Variables and Data Types

Think of a variable as a labeled container that stores data. Common data types in Python are:

  • Integer (int): Whole numbers (e.g., age = 15)
  • Float: Decimal numbers (e.g., price = 99.50)
  • String (str): Text inside quotes (e.g., name = "AI")
  • Boolean: True or False values.
# Example of Variables
x = 10
y = 20
sum = x + y
print(sum)

4. Python Interpreters

Python is an interpreted language. This means the computer reads the code line-by-line and executes it immediately.

💻 Live Activity: Python in the Browser

You don't need to install anything to start! Use Google Colab, a cloud-based Python environment used by real AI engineers worldwide.

Open Google Colab 🚀

Task: Click '+ Code', type print(100 * 5), and click the Play button!

Comments

Chat on WhatsApp