0% found this document useful (0 votes)
13 views5 pages

AIYA Pre-Requisite Session 2

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

AIYA Pre-Requisite Session 2

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

AIYA (For High School Students)

Pre-Requisites
Module 1 – Introduction to Python

AIYA Curriculum- where will Pre-Requisites of this session be applicable


Contents
1. Importance of Python in AI
2. Reading Material
3. Assignment
4. Summary of Reading Material

Importance of Python in AI

Python's pivotal role in Artificial Intelligence (AI) stems from its versatility, simplicity, and
rich library ecosystem. With a clean syntax and readability, Python facilitates the
development of concise AI code, crucial for complex algorithms. Its widespread use,
supported by libraries like NumPy and scikit-learn, fosters collaborative innovation, while
compatibility with frameworks such as TensorFlow enhances seamless integration,
affirming Python's effectiveness in unlocking AI's full potential.

Reading Material:

Introduction to Python (w3schools.com)


Python Variables (w3schools.com)
Python Data Types (w3schools.com)
Python Lists (w3schools.com)
Python Dictionaries (w3schools.com)
Assignment 1: (Test your understanding):

Problem 1:

List Operations –
Create a Python script that:
1. Initializes a list of numbers
2. Sorts the list in ascending order
3. Finds the maximum and minimum values in the list
4. Calculates the sum and average of all the numbers in the list

Problem 2:

Tuple Manipulation –
Write a Python script that:
1. Defines a tuple containing the days of the week
2. Asks the user to input a number representing a day (e.g., 1 for Monday, 2 for
Tuesday, and so on)
3. Displays the corresponding day of the week based on the user's input

Assignment 2:

Problem 1:
Dictionary Operations –
1. Develop a Python script that:
2. Creates a dictionary storing student names as keys and their ages as values
3. Provides functionality to:
- Add a new student to the dictionary
- Update the age of an existing student
- Remove a student from the dictionary based on the user's input (student's name)
- Displays the total count of students in the dictionary
Problem 2:
Array Manipulation –
Build a Python script that:
1. Creates an array (using the array module or Python list) containing a sequence of
numbers.
2. Prompts the user to enter a number
3. Searches for the entered number in the array and displays whether it exists in the
array or not. If present, also show its index

Summary of Reading Material

Variables, Data Types, and Operators:

Variables store data. They can hold different types like integers, floats, or strings.

Python
Variable Stored Data
age = 25
name = “John”

Data types include integers, floats, strings, and more.

Data types Example


Integers age = 25
count = 1000
Floats height = 5.9
price = 19.99
Strings name = "John"
message = "Hello, World!"
Booleans is_adult = True
has_permission = False
Lists colors = ["red", "green", "blue"]
numbers = [1, 2, 3, 4, 5]
Tuples coordinates = (3, 4)
dimensions = (10, 20, 30)
Dictionaries person = {"name": "Alice", "age": 30}
car = {"brand": "Toyota", "model":
"Camry"}

Control Structures (if Statements, Loops):

If statements make decisions based on conditions.

Code Sample Input Sample Output


if age >= 18: age = 20 You are an adult
print("You are an adult.")

For Loops repeat code.

Code Sample Input Sample Output


for i in range(5): 0
print(i) 1
2
3
4

Functions and Modules:

Functions group code into reusable blocks

Code Output
def greet(name): Hello, Alice!
return "Hello, " + name + "!"

print(greet("Alice"))
Modules are files containing Python code that can be reused

Code Output
# In a separate file named utils.py 12
def multiply(x, y):
return x * y

# In the main program


import utils
result = utils.multiply(3, 4)

You might also like