0% found this document useful (0 votes)
1 views29 pages

Python Training Report

Ok

Uploaded by

vikashshah2916
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)
1 views29 pages

Python Training Report

Ok

Uploaded by

vikashshah2916
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

A PROJECT REPORT

ON
MOVIE RATING AND RECOMMENDATIONS ANALYZER USING NUMPY , PANDAS ,
MATPLOTLIB AND SCIKIT – LEARN

SUBMITTED TO

K S RANGASAMY COLLEGE OF ARTS AND SCIENCE (AUTONOMOUS)

SUBMITTED BY
STUDENT NAME : NIRMALKUMAR.P
REGISTER NO : 24UCA155
STUDENT NAME : HARINI.S
REGISTER NO : 24UCA079
CLASS : III - BCA – A
DEPARTMENT : BACHELOR OF COMPUTER
APPLICATION

UNDER THE GUIDANCE OF


NITHYA . S
DESIGNATION : PYTHON
INDEX

[Link] TITLE [Link]

1 COMPANY OVERVIEW 3
2 OVERVIEW OF PYTHON 4
3 INTRODUCTION TO PYTHON 4
4 ENVIRONMENT SETUP 4
5 BASIC INPUT AND OUTPUT OPERATIONS WITH CODE 4

6 CONDITIONAL BRANCHING STATEMENTS WITH CODE 5

7 CONTROL STATEMENTS WITH CODE 5


8 LOOPS(FOR,WHILE) WITH CODE 6
9 FUNCTION AND DEFINING FUNCTIONS WITH CODE 7

10 KEY ARGUMENTS WITH CODE 8


11 RECURSIVE FUNCTION WITH CODE 9
12 LAMBDA FUNCTIONS WITH CODE 9
13 BUILT-IN FUNCTIONS WITH CODE 10
14 DATA STRUCTURES (LIST,TUPLE,SET,DICTIONARIES, 11
…)WITH CODE
15 MODULE WITH CODE : 14
 CREATING MODULES 14
 IMPORTING MODULES 14
 USING BUILT-IN MODULES 14
19 FILE HANDLING AND EXCEPTION HANDLING WITH 16
CODE :
 FILE OPERATIONS 16
 READING AND WRITING 16
 FILE MODES 16
 ERROR HANDLING 16
20 OBJECT-ORIENTED PROGRAMMING(OOP) WITH 17
CODE :

1
 CLASSES AND OBJECTS 18
 INHERITANCE 18
 POLYMORPHISM 18
21 ADVANCED MODULES: 19
 REGULAR EXPRESSIONS(re) 19
 DATE AND TIME LIBRARIES(datetime) 19
 GUI PROGRAMMING(tkinter) 19
22 DATABASE CONNECTIVITY 21
23 NETWORKING: 22
 SERVER AND CLIENT 22
 SERVER PROGRAM 23
 CLIENT PROGRAM 23
24 TOOLS AND TECHNOLOGIES USED : 25
 GENERAL PURPOSE LIBRARIES 25
 DATA SCIENCE AND ANALYSIS LIBRARIES 25
 MACHINE LEARNING AND ARTIFICIAL 25
INTELLIGENCE LIBRARIES
26
25 PROJECT
26 CONCLUSION 28

2
COMPANY OVERVIEW

CodeBind Technologies is an ISO 9001:2015 certified technical training and IT solutions provider founded in 2013. The
company serves a dual purpose in the technology ecosystem: engineering high-end software solutions for enterprise
clients and delivering industry-grade technical training to engineering and computer science students. The company
operates multiple strategic hubs across South India, with its headquarters in Chennai and prominent regional branches
in Salem, Coimbatore, and Trichy. The internship was successfully completed at the Salem regional branch, which serves
as a major hub for technical skill development and client project delivery in the region.

3
OVERVIEW OF PYTHON

Python is one of the most popular and easy-to-learn programming languages used in software development,
web applications, automation, data science, artificial intelligence, and networking. This training program is
designed to provide students with both theoretical knowledge and practical skills in Python programming.

The course begins with the fundamentals of Python and gradually moves toward advanced concepts such as
Object-Oriented Programming, database connectivity, networking, and project development.

Objectives of the Training:

 To understand the basics of Python programming.


 To develop logical and problem-solving skills.
 To learn file handling and exception management.
 To gain knowledge in Object-Oriented Programming concepts.
 To work with databases using MySQL.
 To understand networking concepts using Python.
 To develop mini projects using Python technologies.

[Link] TO PYTHON

Python is a simple, high-level, and interpreted programming language. It is easy to learn and widely used for
web development, data science, artificial intelligence, and automation. Python has simple syntax, making it
beginner-friendly and popular among programmers.

ENVIRONMENT SETUP

Environment setup means installing Python software and an editor to write programs. Python can be
downloaded from the official website.
Editors like PyCharm or Visual Studio Code are commonly used. After installation, Python programs can be
executed easily.

BASIC INPUT AND OUTPUT OPERATIONS

Input and output operations are used to interact with users. input() takes data from the user, while print()
displays output on the screen. These operations are basic building blocks of Python programming. They help
in creating interactive programs.

4
Code:
name = input("Enter Name: ")
print(name)

Output:
Enter Name: Arun
Arun

CONDITIONAL BRANCHING STATEMENTS

Conditional statements are used to make decisions in a program. The if, if-else, and if-elif-else statements
execute different blocks based on conditions. They help control program flow. Conditions are evaluated as true
or false.
Code:
a=74
b=85
c=54
if a>=b and a>=c:
largest=a
elif b>=a and b>=c:
largest=b
else:
largest=c
print("the largest number is:",{largest})

Output:
The largest number is : 85

CONTROL STATEMENTS
Control statements modify the execution of loops. break stops the loop, continue skips an iteration, and pass
acts as a placeholder. These statements improve loop control and flexibility. They are mainly used inside
loops.
Code:

5
for i in range(5):
if i == 1:
continue
if i == 3:
break
pass
print(i)

Output:
0
2

LOOPS (FOR, WHILE)

Loops are used to repeat statements multiple times. The for loop is used when the number of iterations is
known, while the while loop runs until a condition becomes false. Loops reduce code repetition. They make
programs efficient.
Code: (for)
for ch in “python”:
print(ch)

Output:
p
y
t
h
O
n

Code: (while)
i=2
while i <= 10:

6
print(i)
i += 2

output:
2
4
6
8
10

FUNCTION AND DEFINING FUNCTIONS

Functions are reusable blocks of code that perform specific tasks. They are defined using the def keyword.
Functions improve code readability and reduce repetition. They can accept parameters and return values.
Code:
def greet():
print("Hello, World!")
def add(a, b):
return a + b
def welcome(name="Guest"):
print("Welcome", name)
def calculate(a, b):
return a + b, a - b
greet()
result = add(5, 3)
print("Addition:", result)
welcome()
welcome("John")
sum_value, diff_value = calculate(10, 5)
print("Sum:", sum_value)
print("Difference:", diff_value)

7
Output:
Hello, World!
Addition: 8
Welcome Guest
Welcome John
Sum: 15
Difference: 5

KEYWORD ARGUMENTS

Keyword arguments pass values to functions using parameter names. The order of arguments does not matter
when keywords are used. This makes function calls more clear and understandable. It improves code
readability.
Code:
class Demo:
def show(self, name):
print("Name:", name)
@classmethod
def college(cls, college):
print("College:", college)
@staticmethod
def add(a, b):
print("Sum =", a + b)
d = Demo()
[Link](name="Arun")
[Link](college="ABC College")
[Link](a=10, b=5)

Output:
Name: Arun
College: ABC College
Sum = 15

8
RECURSIVE FUNCTION

A recursive function is a function that calls itself repeatedly. It solves problems by breaking them into smaller
subproblems. A stopping condition is necessary to avoid infinite recursion. Recursion is commonly used in
mathematical problems.

Code:
def fact(n):
if n == 1:
return 1
return n * fact(n-1)

print(fact(5))

Output:
120

LAMBDA FUNCTION

A lambda function is a small anonymous function written in one line. It is defined using the lambda keyword.
Lambda functions are mainly used for short operations. They make code compact and simple.
Code:
class Demo:
square = lambda self, x: x * x
@classmethod
def message(cls, text):
print("Message:", text)
@staticmethod
def add(a, b):
print("Sum =", a + b)
d = Demo()
print("Square =", [Link](x=5))
[Link](text="Hello")
9
[Link](a=10, b=5)

Output:
Square = 25
Message: Hello
Sum = 15

BUILT-IN FUNCTIONS

Built-in functions are predefined functions provided by Python. Examples include len(), max(), min(), and
sum(). They perform common operations easily. These functions save programming time and effort.
Code:
class Demo:
def show(self, text):
print([Link]())
@classmethod
def length(cls, text):
print("Length =", len(text))
@staticmethod
def maximum(a, b):
print("Maximum =", max(a, b))
d = Demo()
[Link](text="python")
[Link](text="Programming")
[Link](a=10, b=25)

Output:
PYTHON
Length = 11
Maximum = 25

10
DATA STRUCTURES

Data structures are used to store and organize data efficiently. Python provides lists, tuples, sets, and
dictionaries. Each structure has different properties and uses. They help manage large amounts of data.
List:
Lists are ordered and mutable collections. Elements can be added, removed, or changed. Lists are created
using square brackets [ ]. They can store multiple data types.
Code:
list1 = [10, 20, 30]
[Link](40)
print("After append:", list1)
[Link](1, 15)
print("After insert:", list1)
[Link](20)
print("After remove:", list1)
[Link]()
print("After pop:", list1)
[Link]()
print("After sort:", list1)
[Link]()
print("After reverse:", list1)
print("Length:", len(list1))

Output:
After append: [10, 20, 30, 40]
After insert: [10, 15, 20, 30, 40]
After remove: [10, 15, 30, 40]
After pop: [10, 15, 30]
After sort: [10, 15, 30]
After reverse: [30, 15, 10]
Length: 3

11
Tuple:
Tuples are ordered and immutable collections. Once created, their values cannot be changed. Tuples use
parentheses ( ). They are faster than lists.
Code:
tuple1 = (10, 20, 30, 20)
print("Tuple:", tuple1)
print("Count of 20:", [Link](20))
print("Index of 30:", [Link](30))
print("Length:", len(tuple1))

Output:
Tuple: (10, 20, 30, 20)
Count of 20: 2
Index of 30: 2
Length: 4

Set:
Sets are unordered collections of unique elements. Duplicate values are automatically removed. Sets are
created using curly braces { }. They are useful for mathematical operations.
Code:
set1 = {10, 20, 30}
[Link](40)
print("After add:", set1)
[Link](20)
print("After remove:", set1)
[Link](50)
print("After discard:", set1)
[Link]()
print("After pop:", set1)
print("Length:", len(set1))
12
Output:
After add: {40, 10, 20, 30}
After remove: {40, 10, 30}
After discard: {40, 10, 30}
After pop: {10, 30}
Length: 2

Dictionary:
A dictionary stores data in key-value pairs. Keys must be unique and are used to access values. Dictionaries
use curly braces { }. They are useful for storing structured data.
Code:
dict1 = {"name": "Arun", "age": 20}
[Link]({"city": "Hosur"})
print("After update:", dict1)
[Link]("age")
print("After pop:", dict1)
print("Keys:", [Link]())
print("Values:", [Link]())
print("Items:", [Link]())
print("Length:", len(dict1))

Output:
After update: {'name': 'Arun', 'age': 20, 'city': 'Hosur'}
After pop: {'name': 'Arun', 'city': 'Hosur'}
Keys: dict_keys(['name', 'city'])
Values: dict_values(['Arun', 'Hosur'])
Items: dict_items([('name', 'Arun'), ('city', 'Hosur')])
Length: 2

13
[Link]
Python modules are files containing Python code that you can reuse across different projects. They allow you to
organize large programs into smaller, manageable, and shareable files.

CREATING MODULES
Any Python file ending in .py can function as a module. You simply write functions, classes, or variables
inside that file. Create a file named [Link].
 Add the following code to it.

IMPORTING MODULES
To use the code from [Link] in another file, you must import it. Create a new file (e.g., [Link]) in
the same folder and use one of the following methods.
 Basic Import : Imports the whole module. You must use the module name as a prefix to access its
content.
 Specific Import : Imports only specific functions or variables. You do not need the module prefix.
 Import with an Alias : Renames the module or function during import to make your code shorter or
avoid name conflicts.

USING BUILT-IN MODULES


Python comes with a rich library of built-in modules ready to use without any installation.
 The math module provides mathematical functions.
 The random Module used for generating random numbers or choices.
 The datetime Module used for working with dates and times.

Code:

import calculator

print([Link](10, 5))

print([Link])

from calculator import subtract

print(subtract(10, 5))

import calculator as calc

from calculator import add as sum_func

14
print([Link](20, 10))

print(sum_func(4, 4))

import math

import random

import datetime

print([Link](25))

print([Link](1, 100))

print([Link]())

Output:

15

PyCalc 1.0

10

5.0

73

2026-05-22

15
FILE HANDLING AND EXCEPTION HANDLING

File handling allows Python to read and write permanent data on your hard drive, while exception handling
ensures your program doesn't crash when unexpected errors occur.

File Operations

File operations involve opening, modifying, and closing data files. Python uses the with open() syntax to
handle these steps safely. It automatically frees up system memory when processing finishes.

Reading and Writing

Reading pulls data from storage into your program using tools like .read(). Writing saves your program's
active data back onto your drive using .write(). Together, they let apps save progress permanently.

File Modes

Modes set access permissions when a file opens. Read ('r') views files, write ('w') overwrites contents
completely, and append ('a') adds new lines to the end. Selecting the wrong mode can erase data.

Error Handling

Error handling prevents software from crashing during unexpected system failures.
 assert checks if base conditions are met first.
 try isolates high-risk actions, and except safely catches errors to keep apps running.

Code:

filename = "[Link]"

assert len(filename) > 0, "Filename cannot be empty!"

try:

with open(filename, "w") as file:

[Link]("Hello World!\nPython File Handling.")

print("File written successfully.")

16
except IOError:

print("Error: Could not write to file.")

try:

with open(filename, "r") as file:

content = [Link]()

print("\n--- File Content ---")

print(content)

print("--------------------")

except FileNotFoundError:

print("Error: The file does not exist.")

with open(filename, "a") as file:

[Link]("\nAppended new text line.")

try:

with open("missing_file.txt", "r") as file:

data = [Link]()

except FileNotFoundError as error:

print(f"\nCaught expected error: {error}")

Output:

File written successfully.

--- File Content ---

Hello World!

Python File Handling.

--------------------

Caught expected error: [Errno 2] No such file or directory: 'missing_file.txt'

4. OBJECT-ORIENTED PROGRAMMING (OOP)


Object-Oriented Programming (OOP) uses "classes" as blueprints to create "objects" that group data and
actions together. It uses inheritance to let new classes copy and reuse code from older parent classes without
rewriting it. Finally, polymorphism allows different objects to run their own unique versions of the exact same
command.
17
CLASSES AND OBJECTS
A class acts as a blueprint or template for creating real-world items. An object is the actual instance built from
that blueprint. Classes group data attributes and functional behaviors into a single package.

INHERITANCE
Inheritance allows a new child class to adopt attributes and methods from an existing parent class. This cuts
down on duplicate code by reusing foundation logic. Child classes can still add unique features.

POLYMORPHISM
Polymorphism allows different classes to share the exact same method name but execute unique behaviors.
The system automatically triggers the correct action based on the specific object currently running.
Code:
class Animal:
def __init__(self, name):
[Link] = name
def make_sound(self):
return "Some generic sound"
class Dog(Animal):
def make_sound(self):
return "Bark!"
class Cat(Animal):
def make_sound(self):
return "Meow!"
dog = Dog("Buddy")
cat = Cat("Whiskers")
print(f"{[Link]} says: {dog.make_sound()}")
print(f"{[Link]} says: {cat.make_sound()}")
zoo_animals = [Dog("Max"), Cat("Luna"), Dog("Rocky")]
for animal in zoo_animals:
print(f"Zoo animal {[Link]} goes: {animal.make_sound()}")

Output:

Buddy says: Bark!

Whiskers says: Meow!


18
Zoo animal Max goes: Bark!

Zoo animal Luna goes: Meow!

Zoo animal Rocky goes: Bark!

[Link] Modules

Regular Expressions (re)

Regular expressions use specialized text patterns to search, extract, and validate complex string data like
email addresses or phone numbers. They act as an advanced find-and-replace tool for code.

Date and Time Libraries (datetime)

These libraries allow your code to track system clocks, calculate time gaps, and format timestamps. They are
essential for scheduling events, logging actions, and handling deadlines.

GUI Programming (tkinter)

Graphical User Interface (GUI) programming moves your code out of the command terminal and into visual
windows. It provides the clickable buttons, text boxes, and menus that users expect in modern apps.

Code:
import datetime
import re
import tkinter as tk
def check_email():
user_input = email_entry.get()
pattern = r"^[\w\.-]+@[\w\.-]+\.\w+$"
if [Link](pattern, user_input):
result_label.config(text="Valid Email Status: Success!", fg="green")
else:
result_label.config(text="Valid Email Status: Invalid!", fg="red")
now = [Link]()
formatted_time = [Link]("%Y-%m-%d %H:%M:%S")
root = [Link]()
[Link]("Advanced Modules Demo")
19
[Link]("400x250")
time_label = [Link](root, text=f"Application Started: {formatted_time}")
time_label.pack(pady=10)
instruction_label = [Link](root, text="Enter Email to Validate:")
instruction_label.pack(pady=5)
email_entry = [Link](root, width=30)
email_entry.pack(pady=5)
validate_button = [Link](root, text="Validate Format", command=check_email)
validate_button.pack(pady=5)
result_label = [Link](root, text="Valid Email Status: Waiting...")
result_label.pack(pady=10)
[Link]()

Output:
Valid Email Status: Invalid!(for wrong mail)

Valid Email Status: Success!

20
[Link] CONNECTIVITY

MySQL connectivity links your Python scripts to external relational databases by authenticating via a host
address, username, and secure password.

Creating tables sets up structured database layouts with distinct column schemas, strict data types, and primary tracking
keys.

Inserting and viewing tables allow programs to permanently write active user records and pull that stored relational
data back into application memory loops.

Code:

import [Link]

try:

db = [Link](

host="localhost", user="root", password="your_password"

cursor = [Link]()

[Link]("CREATE DATABASE IF NOT EXISTS school_db")

[Link]("USE school_db")

[Link](

"""

CREATE TABLE IF NOT EXISTS students (

id INT AUTO_INCREMENT PRIMARY KEY,

name VARCHAR(100),

grade VARCHAR(10)

"""

print("Table verified/created successfully.")

insert_query = "INSERT INTO students (name, grade) VALUES (%s, %s)"

student_data = ("Alice Smith", "A")

21
[Link](insert_query, student_data)

[Link]()

print(f"Record inserted successfully. Rows affected: {[Link]}")

[Link]("SELECT * FROM students")

rows = [Link]()

print("\nViewing Table Records")

for row in rows:

print(f"ID: {row[0]} | Name: {row[1]} | Grade: {row[2]}")

except [Link] as error:

print(f"Database error occurred: {error}")

finally:

if "db" in locals() and db.is_connected():

[Link]()

[Link]()

print("MySQL connection safely closed.")

Output;

Table verified/created successfully.

Record inserted successfully. Rows affected: 1

Viewing Table Records

ID: 1 | Name: Alice Smith | Grade: A

MySQL connection safely closed.

22
[Link]
Server and Client
To test this, you run the Server script first to make it listen for connections, then run the Client script to send a
message.
 Server Program ([Link])
 Client Program ([Link])

Server Program
A server program runs continuously on a hosting computer, opening a specific communication port
and waiting for incoming data requests. It binds to an IP address, listens for remote connections, and
accepts incoming traffic to establish a dedicated communication channel. Once connected, it
processes incoming data packets and sends back matching replies.

Code:
import socket
server_socket = [Link](socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind(("[Link]", 65432))
server_socket.listen(1)
print("Server is waiting for a connection...")
connection, address = server_socket.accept()
print(f"Connected by {address}")
data = [Link](1024).decode()
print(f"Received from client: {data}")
[Link]("Hello from Server!".encode())
[Link]()
server_socket.close()

Output:

Server is waiting for a connection...

Connected by ('[Link]', 51042)

Received from client: Hello from Client!

23
Client Program
A client program initiates the network connection by actively targeting a server's known IP address and port
number. It connects to the waiting host, packages text or files into bytes, and sends them across the network
stream. After transmitting its request, it pauses to receive the server's reply before safely closing the
connection channel.
Code:
import socket
client_socket = [Link](socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(("[Link]", 65432))
client_socket.sendall("Hello from Client!".encode())
response = client_socket.recv(1024).decode()
print(f"Received from server: {response}")
client_socket.close()

Output:
Received from server: Hello from Server!

24
TOOLS AND TECHNOLOGIES USED
The development of this project was carried out using the Python programming language along with several
important libraries and tools. These libraries helped in data processing, mathematical operations, visualization,
and machine learning implementation.

GENERAL PURPOSE LIBRARIES


 os – Used for interacting with the operating system and managing files/directories.
 sys – Provides system-specific parameters and functions.
 math – Supports mathematical calculations and operations.
 random – Used for generating random values and selections.
 datetime – Helps in handling date and time-related operations.

DATA SCIENCE AND ANALYSIS LIBRARIES


 NumPy – Used for numerical computing and array operations.
 Pandas – Used for data analysis, data manipulation, and table handling.
 Matplotlib – Used for creating graphs and visual representations of data.
 Seaborn – Used for advanced statistical data visualization.

MACHINE LEARNING AND ARTIFICIAL INTELLIGENCE LIBRARIES


 Scikit-learn – Used for implementing machine learning algorithms, model training, and prediction.

These tools and libraries improved the efficiency, accuracy, and overall performance of the project
development process.

25
PROJECT
STOCK MARKET ANALYSIS AND PRICE PREDICTION SYSTEM USING
NUMPY , PANDAS, MATPLOTLIB AND SCIKIT-LEARN
Code:
import [Link] as plt
import pandas as pd
import yfinance as yf
ticker_symbol = "AAPL"
start_date = "2025-01-01"
end_date = "2026-05-22"
print(f"Fetching data for {ticker_symbol}...")
data = [Link](ticker_symbol, start=start_date, end=end_date)
if isinstance([Link], [Link]):
[Link] = [Link](1)
data["MA50"] = data["Close"].rolling(window=50).mean()
data["MA200"] = data["Close"].rolling(window=200).mean()
print("\nLatest Stock Data & Moving Averages:")
print(data[["Close", "MA50", "MA200"]].tail())
[Link](figsize=(12, 6))
[Link](
[Link], data["Close"], label=f"{ticker_symbol} Close Price", color="blue"
)
[Link]([Link], data["MA50"], label="50-Day Moving Average", color="orange")
[Link](
[Link], data["MA200"], label="200-Day Moving Average", color="red"
)
26
[Link](f"{ticker_symbol} Price and Moving Average Analysis")
[Link]("Date")
[Link]("Price (USD)")
[Link]()
[Link](True)
[Link]()

Output:

27
Conclusion:

The Python Training program provides complete knowledge from basic to advanced concepts of Python
programming. Through practical sessions and project work, students gain hands-on experience in coding,
database connectivity, GUI development, and networking. This training helps learners build a strong foundation
for careers in software development and related technologies.

28

You might also like