0% found this document useful (0 votes)
3 views7 pages

AI For Usman

The document is a lab manual for a Programming for AI course, detailing the setup of Python development environments, including installation, code editors, and package management. It introduces Python programming concepts, data types, control structures, and basic syntax, alongside an overview of Artificial Intelligence and its key concepts. Additionally, it covers libraries like NumPy, Pandas, and Matplotlib for numerical computing, data analysis, and visualization.

Uploaded by

urajpoot559
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

AI For Usman

The document is a lab manual for a Programming for AI course, detailing the setup of Python development environments, including installation, code editors, and package management. It introduces Python programming concepts, data types, control structures, and basic syntax, alongside an overview of Artificial Intelligence and its key concepts. Additionally, it covers libraries like NumPy, Pandas, and Matplotlib for numerical computing, data analysis, and visualization.

Uploaded by

urajpoot559
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Lyallpur institute of Digital Computing

LAB MANUAL
Programming for AI (Python)

Submitted by
Name: Muhammad Usman
Id: LIDCADDSAI241102003
Class/Section: BS(AI)

Submitted to
Instructor Name: Sir Zeeshan Akhter
Department: Artificial Intelligence
Setting Up Development Environments for Python

1. Install Python
o Download the latest version from python.org.
o Check the box "Add Python to PATH" during installation.

2. Verify Installation
o Open the terminal or command prompt and run:

3. Choose a Code Editor or IDE


o VS Code: Lightweight with Python extensions.
o PyCharm: Dedicated Python IDE.
o Jupyter Notebook: Best for data science.

4. Set Up a Virtual Environment


o Create: python -m venv myenv
o Activate:

5. Install Packages

pip install numpy pandas matplotlib

6. Write and Run Code

python app.py
Introduction to Python Programming Language
Python is a high-level, interpreted language known for its readability and simplicity. Created by
Guido van Rossum in 1991, Python emphasizes clean syntax, making it beginner-friendly.

Key Features of Python:

1. Readable Syntax: Uses indentation instead of braces.


2. Dynamically Typed: No need to declare variable types.
3. Interpreted Language: Executes line by line.
4. Object-Oriented: Supports classes and objects.
5. Cross-Platform: Works on Windows, macOS, and Linux.

Data Types in Python

Python has several built-in data types:

1. Numeric Types:

2. Sequence Types:

3. Mapping Type:
4. Set Types:

5. Boolean Type:
o bool: True or False

6. Binary Types:
o bytes, bytearray

Control Structures in Python


Conditional Statements

Loop Control Statements

 break: Exits loop.


 continue: Skips iteration.
 pass: Placeholder.
Introduction to Artificial Intelligence
Artificial Intelligence (AI) enables machines to perform tasks requiring human intelligence. AI
systems learn from data and improve over time.

Key Concepts in AI:

1. Machine Learning (ML): Algorithms that improve with data.


o Supervised Learning: Uses labeled data (e.g., spam detection).
o Unsupervised Learning: Finds patterns (e.g., customer segmentation).
o Reinforcement Learning: Learns via trial and error (e.g., self-driving cars).
2. Deep Learning: Uses neural networks for complex tasks like image recognition.
3. Natural Language Processing (NLP): Helps machines understand human language (e.g.,
chatbots, Google Translate).
4. Computer Vision: AI interprets visual data (e.g., facial recognition).
5. Robotics: AI-driven robots perform real-world tasks (e.g., self-driving cars).

Basic Syntax in Python


Comments

Variables and Data Types

x = 10 # Integer
y = 3.14 # Float
name = "Alice" # String

Printing Output
print("Hello, World!")
print(x, y, name)
Indentation

Python uses indentation for code blocks.

Functions

Lists & Dictionaries


# List
fruits = ["apple", "banana", "cherry"]
fruits.append("orange")

# Dictionary
person = {"name": "Alice", "age": 25}
person["age"] = 26

NumPy, Pandas, and Matplotlib


NumPy

NumPy is used for numerical computing.

import numpy as np
arr = np.array([1, 2, 3])
print(arr)

Pandas

Pandas is used for data analysis.


Matplotlib

Matplotlib is used for data visualization.

Thank you

You might also like