1.
Introduction to Python
Python is a versatile, high-level programming language created by Guido van Rossum. It
emphasizes simplicity, readability, and productivity. During the training, we learned why
Python is widely used in software development, AI, automation, and data analysis.
Key features include dynamic typing, an extensive standard library, and support for
multiple programming paradigms. Python scripts run line by line using its interpreter, which
makes debugging easier.
The training introduced installation, running Python programs, understanding indentation,
keywords, and writing clean and modular code.
Example Program:
# Basic Python Syntax
print("Hello, World!")
# Indentation Example
for i in range(5):
print("Python loop:", i)
2. Using Variables in Python
Variables in Python act as containers for storing data. Unlike other languages, Python
does not require explicit type declaration; it assigns the type automatically based on value.
We also learned about numeric types (int, float), text type (str), collection types (list, tuple,
dict, set), and how Python handles memory dynamically.
Python also supports input from the user and converting those inputs into desired types
using type casting.
Example Program:
# Variable Example
name = "Mayank"
age = 20
salary = 25000.50
print("Name:", name)
print("Age:", age)
print("Salary:", salary)
# User Input
user = input("Enter your name: ")
print("Hello", user)
3. Basics of Programming in Python
This module taught operators (arithmetic, logical, comparison), conditional statements (if,
elif, else), and loops (for, while). Functions were introduced for reusability and modular
coding.
We practiced writing programs that included decision-making patterns, menu-driven
applications, and error-handling using try-except blocks.
Example Program:
# Condition Example
num = 10
if num > 0:
print("Positive number")
else:
print("Negative number")
# Loop Example
for i in range(1, 11):
print("Table of 2:", 2*i)
# Function Example
def add(a, b):
return a + b
print("Sum:", add(5, 3))
4. Object-Oriented Programming (OOP)
OOP enables us to structure software around objects instead of functions. Python
supports all five OOP pillars: classes, objects, inheritance, polymorphism, abstraction, and
encapsulation.
We created classes with constructors (__init__), used self keyword, implemented
single/multiple inheritance, method overriding, and built small OOP-based applications.
Example Program:
# Class and Object Example
class Car:
def __init__(self, brand, model):
[Link] = brand
[Link] = model
def show(self):
print("Car:", [Link], [Link])
obj = Car("Toyota", "Fortuner")
[Link]()
# Inheritance Example
class Student:
def info(self):
print("I am a student")
class Marks(Student):
def score(self):
print("My marks are 90")
m = Marks()
[Link]()
[Link]()
5. Working with SQLite Database in Python
SQLite is a serverless, lightweight relational database used in small to medium
applications. Python provides native support through sqlite3 module.
We learned connecting to databases, creating tables, inserting records, fetching data, and
closing connections.
The training included practical implementation of CRUD operations and real database
workflows.
Example Program:
import sqlite3
con = [Link]("[Link]")
cur = [Link]()
[Link]("CREATE TABLE IF NOT EXISTS student(name TEXT, age INTEGER)")
[Link]("INSERT INTO student VALUES('Mayank', 20)")
[Link]()
rows = [Link]("SELECT * FROM student").fetchall()
print(rows)
[Link]()
6. GUI Development with PyQt
PyQt is a Python toolkit for creating desktop applications. It provides widgets such as
buttons, labels, input boxes, layouts, frames, menus, and dialogs.
We learned event handling (signal-slot mechanism), window designing, and building
simple GUI apps.
Example Program:
from [Link] import QApplication, QLabel, QWidget
app = QApplication([])
window = QWidget()
[Link]("My First GUI")
label = QLabel("Hello GUI", parent=window)
[Link]()
app.exec_()
7. Applications of Python
Python is used in automation, web development, scientific computing, AI, machine
learning, cybersecurity, IoT, cloud computing, data visualization, and more.
We explored real-world use cases such as data scraping, file automation, and algorithmic
processing.
8. Final Project
The final project demonstrated the integration of all learned concepts: variables, functions,
OOP, database handling, and GUI.
It involved writing structured code, documenting modules, generating outputs, and testing
the complete workflow.
9. AI Modules in Python
Artificial Intelligence in Python uses libraries such as NumPy, Pandas, Matplotlib,
Scikit-Learn, TensorFlow, and Keras.
We explored supervised learning models, dataset handling, and prediction algorithms.
Example Program:
from sklearn.linear_model import LinearRegression
model = LinearRegression()
# [Link](X, y)