Niranjan
Niranjan
Submitted by
Mr. NIRANJAN P
Register Number: 23UBCA063
BONAFIDE CERTITICATE
This is to certify that the Internship report entitled “Python Programming”
submitted by Mr. NIRANJAN (Reg. No.: 23UBCA063) during the Academic Year 2025 –
2026 in partial fulfillment of the requirements for the award of the degree of Bachelor of
Computer Applications to Sri Vidya Mandir Arts & Science College (Autonomous),
Katteri – 636 902, Uthangarai, Krishnagiri District, Tamil Nadu.
2
ACKNOWLEDGEMENT
At the very outset I offer my sincere thanks to Almighty God for the grace and
blessings that made me to complete the internship in a successful manner. I sincerely thank
my parents who have gifted me this life to attain many achievements.
Finally, I thank each and every one of my friends, especially who have assisted me in
completing my internship training.
( NIRANJAN P )
3
4
Abstract
The internship also emphasized GUI development with Tkinter and data visualization using
Matplotlib, giving a holistic view of Python's capabilities in both backend and frontend
scripting. As part of the program, a mini project was developed to apply the knowledge
gained and demonstrate practical implementation of the concepts learned.
The hands-on sessions, daily coding exercises, and final project helped in bridging the gap
between academic learning and industry requirements. This internship significantly
strengthened logical thinking, debugging skills, and real-time problem-solving abilities,
laying a strong foundation for a career in software development, data analysis, and
automation using Python.
5
Tabel Of Content
17 Conclusion
18 Appendix&Reference
6
Introduction to Python and Installation
What is Python?
Python emphasizes code readability and allows developers to express concepts in fewer lines
of code than many other programming languages, such as C, C++, or Java.
Year Event
1991 .
Python 0.9.0 is released with classes,
exceptions, and core data types.
2008
Python 3.0 (also called "Python 3000")
released, not backward compatible with
Python 2.
7
Key Features of Python
1. Easy to Learn and Use
2. Interpreted Language
3. Dynamically Typed
Built-in modules for file I/O, web services, OS interaction, and more.
5. Cross-Platform
Python runs on Windows, macOS, and Linux without changing the code.
Applications of Python
Python is used in a wide variety of real-world applications:
8
Cybersecurity Scripting, penetration testing
A variable is a named memory location used to store data. In Python, you do not need to
declare the type of variable before using it — Python automatically understands the type
based on the value assigned.
Example:
name = "Praveen"
age = 21
score = 88.5
Dynamic Typing
Python is dynamically typed, which means you can reassign variables with different
types.
x = 10 # x is an integer
Think of data types like labels that tell Python what kind of data you're working with,
such as numbers, text, or collections of data.
9
Python supports various data types:
name = "Python"
age = 25
pi = 3.14
is_valid = True
print(type(name))
print(type(age))
print(type(pi))
print(type(is_valid))
Output:
<class 'str'>
<class 'int'>
<class 'float'>
<class 'bool'>
10
Operators in Python
In Python, operators are special symbols used to perform operations on variables and
values. They help you manipulate data, make comparisons, and control the flow of your
program.
1. Arithmetic Operators:
- + (addition)
- - (subtraction)
- * (multiplication)
- / (division)
- ** (exponentiation)
- % (modulus)
2. Comparison Operators:
- == (equal to)
3. Logical Operators:
- or (logical or)
4. Assignment Operators:
- = (assignment)
- += (addition assignment)
- -= (subtraction assignment)
- *= (multiplication assignment)
11
- /= (division assignment)
5. Membership Operators:
1.Arithmetic Operators
a = 10
b=3
print("Addition:", a + b) # 13
print("Subtraction:", a - b) #7
print("Multiplication:", a * b) # 30
print("Division:", a / b) # 3.33
print("Floor Division:", a // b) # 3
print("Modulus:", a % b) #1
print("Power:", a ** b) # 1000
2.Assignment Operators
x=5
x += 3
print(x) # Output: 8
x *= 2
print(x) # Output: 16
3.Comparison Operators
a = 10
b = 20
print(a == b) # False
12
print(a != b) # True
4.Logical Operators
x = 10
x = [1, 2, 3]
y=x
z = [1, 2, 3]
print(x is y) # True
Conditional Statements
What are Conditional Statements?
Conditional statements are used to execute certain blocks of code only if a specific
condition is true. In Python, conditional statements are used to control the flow of execution
based on certain conditions. Just like we make decisions every day, programs also need to
make decisions and act accordingly.
13
In Python, the most commonly used conditional statements are:
1. if statement
2. if-else statement
3. if-elif-else ladder
4. Nested if statements
These are essential for controlling the flow of the program based on different conditions, just
like decision-making in real life.
Similarly, in Python:
if rain == True:
print("Take umbrella")
else:
1. if Statement
Syntax:
if condition:
# block of code
Example:
age = 18
14
print("You are eligible to vote.")
Output:
2.if-else Statement
Used when you want to execute one block if the condition is true, and another if it is false.
Syntax:
if condition:
# true block
else:
# false block
Example:
mark = 35
print("Pass")
else:
print("Fail")
Output:
Fail
Syntax:
if condition1:
# block 1
elif condition2:
# block 2
15
else:
# final block
Example:
score = 75
print("Grade: A+")
print("Grade: A")
print("Grade: B")
else:
print("Grade: C")
Output:
Grade: A
4.Nested if Statements
Example:
num = 10
if num > 0:
if num % 2 == 0:
else:
else:
print("Non-positive number")
Output:
16
Example: Student Grade Evaluation System
Code:
average = total / 5
print("Name:", name)
# Grade Decision
grade = "A+"
grade = "A"
grade = "B"
grade = "D"
else:
grade = "F"
print("Grade:", grade)
# Pass/Fail Decision
else:
Output (Sample):
Name: Ramesh
Grade: A+
Result: Pass 🎉
Loops in Python
18
What is a Loop?
In Python, a loop is used to execute a block of code repeatedly until a specific condition is
met. Loops help in automating repetitive tasks and reducing code duplication.
Python, loops are used to repeat a block of code multiple times. There are two main types
of loops:
1. For Loop: Used to iterate over a sequence (such as a list, tuple, or string) and execute a
block of code for each item.
2. While Loop: Used to execute a block of code as long as a certain condition is true.
For example:
Type Description
1. for Loop
The for loop is used to iterate over a sequence like a list, tuple, dictionary, string, or a range
of numbers.
Syntax:
# block of code
print(fruit)
Output:
19
apple
banana
cherry
print(i)
Output:
2. while Loop
Syntax:
while condition:
# block of code
i=1
while i <= 5:
print(i)
i += 1
Output:
20
2
Keyword Description
if i == 5:
break
print(i)
Output:
21
if i == 3:
continue
print(i)
Output:
for i in range(3):
import random
guess = 0
else:
Sample Output:
22
Too low! Try again.
Strings:
Immutability: Once a string is created, its content cannot be directly modified. Any
operation that appears to modify a string actually creates a new string with the desired
changes.
Examples:
text1 = 'Hello'
text2 = "World"
text3 = """This is a
multi-line string"""
String Operations
Length len("Python") 6
String Methods
String Example:
print("Length:", len(message))
print("Slice:", message[7:18])
print("Uppercase:", message.upper())
Output:
Length: 18
First character: P
Slice: Programming
24
A list is an ordered collection of items that is mutable (can be changed). Lists can store
multiple types of data.
Example:
numbers = [1, 2, 3, 4, 5]
List Operations
Length len(fruits) 3
List Example:
print("Highest:", max(marks))
print("Lowest:", min(marks))
print("Total:", sum(marks))
print("Average:", sum(marks)/len(marks))
Output:
Highest: 92
Lowest: 78
Total: 433
Average: 86.6
25
fruits = ["apple", "banana", "cherry"]
print(fruit)
Output:
apple
banana
cherry
Nested Lists
matrix = [
[1, 2, 3],
[4, 5, 6]
print(matrix[1][2]) # Output: 6
A function is a block of organized, reusable code that performs a specific task. Python
functions are defined using the def keyword.
Types of Functions
Syntax
def function_name(parameters):
# code block
return result
26
def greet(name):
print("Hello", name)
greet("Praveen")
return a * b
result = multiply(5, 4)
print("Result:", result)
Modules in Python
What is a Module?
A module is a file containing Python code — functions, variables, and classes — that can
be imported into other programs.
Types of Modules
import math
27
File: myutils.py
return a + b
return a - b
Main Program:
import myutils
What I Learned
# student_module.py
students = {}
students[name] = marks
def calculate_average(name):
if name in students:
else:
return None
def get_topper():
28
topper = None
top_avg = 0
top_avg = avg
topper = name
def display_students():
print("\nStudent Records:")
# main_app.py
import student_module
# Adding students
student_module.display_students()
# Finding topper
Sample Output
29
Student Records:
1. Tuples
What is a Tuple?
Syntax
Example
❗ Note:
person[0] = "Kumar" # ❌ Error: 'tuple' object does not support item assignment
2. Sets
30
What is a Set?
Syntax
my_set = {1, 2, 3, 4}
Example
a = {1, 2, 3}
b = {3, 4, 5}
print(a.union(b)) # {1, 2, 3, 4, 5}
print(a.intersection(b)) # {3}
print(a.difference(b)) # {1, 2}
❗ Notes:
No duplicates allowed
Sets are unordered (no indexing)
Useful for mathematical operations and checking unique values
3. Dictionaries
What is a Dictionary?
Syntax
Example
student = {
"name": "Aarthi",
"age": 20,
}
31
print(student["name"]) # Output: Aarthi
Dictionary Methods
student.keys()
student.values()
student.items()
student.get("name")
student.pop("age")
Real-World Example
# Tuple: Coordinates
student = {
"name": "Ravi",
"age": 22,
32
File handling allows a Python program to read from and write to files (like .txt, .csv, etc.).
It is an essential part of many real-world applications such as:
file.close()
file.close()
33
content = file.read()
print(content)
file.close()
file.close()
Function Description
open() Opens a file
read() Reads entire file content
readline() Reads one line
readlines() Reads all lines into a list
write() Writes content to file
close() Closes the file
Concept Description
Class Blueprint for creating objects
Object Instance of a class
Constructor Initializes object state (_init_)
Inheritance One class inherits from another
Polymorphism Many forms (function
overloading/overriding)
Encapsulation Hiding internal details using private members
class Student:
34
def _init_(self, name, age): # Constructor
self.name = name
self.age = age
def display(self):
# Creating an object
s1 = Student("Praveen", 21)
s1.display()
🔍 Output:
2. Encapsulation
Example:
class BankAccount:
self.__balance += amount
def get_balance(self):
return self.__balance
acc = BankAccount(1000)
acc.deposit(500)
3. Inheritance
Example:
35
class Animal:
def speak(self):
print("Animal speaks")
class Dog(Animal):
def speak(self):
print("Dog barks")
d = Dog()
d.speak()
Output:
Dog barks
4. Polymorphism
class Shape:
def area(self):
print("Calculating area...")
class Circle(Shape):
def area(self):
print("Area of Circle")
class Square(Shape):
def area(self):
print("Area of Square")
shape.area()
class Employee:
36
def _init_(self, emp_id, name, salary):
self.emp_id = emp_id
self.name = name
self.salary = salary
def show_details(self):
e1.show_details()
e2.show_details()
Tkinter is the standard GUI (Graphical User Interface) library for Python. It allows you to
create windows, buttons, labels, text boxes, and more to build desktop applications.
import tkinter as tk
root = tk.Tk()
root.geometry("300x200")
label.pack(pady=20)
37
# Start the GUI event loop
root.mainloop()
Widget Description
Label Display text or images
Button Perform an action when clicked
Entry Single-line text input
Text Multi-line text input
Frame Container for organizing widgets
Checkbutton Checkbox widget
Radiobutton Select one from many
import tkinter as tk
def login():
user = username_entry.get()
pwd = password_entry.get()
else:
root = tk.Tk()
root.title("Login Form")
root.geometry("300x200")
tk.Label(root, text="Username:").pack(pady=5)
username_entry = tk.Entry(root)
username_entry.pack()
38
tk.Label(root, text="Password:").pack(pady=5)
password_entry.pack()
# Login button
# Result label
result_label.pack()
root.mainloop()
What is NumPy?
Installing NumPy
Importing NumPy
import numpy as np
---
1. NumPy Arrays
Creating Arrays
39
import numpy as np
print(arr)
Array Types
2. Array Attributes
print(arr.shape) # (2, 3)
print(arr.ndim) #2
print(arr.size) #6
np.arange(0, 10, 2) # [0 2 4 6 8]
a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
print(a + b) # [5 7 9]
print(a * b) # [4 10 18]
print(a ** 2) # [1 4 9]
40
5. Matrix Operations
# Matrix addition
print(A + B)
# Matrix multiplication
print(np.dot(A, B))
# Transpose
print(A.T)
Function Description
np.mean(arr) Mean of elements
np.median(arr) Median value
np.std(arr) Standard deviation
np.sum(arr) Sum of all elements
np.min(arr) Minimum element
np.max(arr) Maximum element
np.sort(arr) Sort elements
np.unique(arr) Get unique values from array
print("Mean:", np.mean(data))
print("Max:", np.max(data))
print("Min:", np.min(data))
41
Pandas is a powerful open-source Python library used for:
Pandas is built on top of NumPy and works well for data wrangling, cleaning, filtering,
grouping, and analysis.
Installing Pandas
Importing Pandas
import pandas as pd
import pandas as pd
print(s)
data = {
df = pd.DataFrame(data)
print(df)
42
df.to_csv("output.csv", index=False) # Writing CSV
✅ Select a column
df['Name'] # As Series
df[df['Subject'] == 'Python']
5. Modifying Data
✅ Delete a column
43
Example: Student Data Analysis
data = {
df = pd.DataFrame(data)
print(df.groupby('Subject')['Marks'].mean())
Matplotlib is a popular Python library used to create static, animated, and interactive plots
and charts. It helps in understanding data through visual representation.
The most commonly used module of matplotlib is pyplot, which provides functions similar to
MATLAB for plotting.
x = [1, 2, 3, 4, 5]
plt.plot(x, y)
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.grid(True)
44
plt.show()
2. Bar Chart
plt.title("Student Marks")
plt.xlabel("Students")
plt.ylabel("Marks")
plt.show()
3. Pie Chart
plt.show()
4. Histogram
import numpy as np
plt.title("Histogram of Scores")
plt.xlabel("Score")
plt.ylabel("Frequency")
plt.show()
45
5. Scatter Plot
plt.scatter(x, y, color='red')
plt.xlabel("X Data")
plt.ylabel("Y Data")
plt.show()
x = [1, 2, 3, 4, 5]
y2 = [1, 2, 3, 4, 5]
plt.xlabel("X")
plt.ylabel("Y")
plt.legend()
plt.show()
plt.title("Customized Plot")
plt.xlabel("X Axis")
plt.ylabel("Y Axis")
plt.grid(True)
46
plt.show()
plt.title("Student Performance")
plt.xlabel("Student")
plt.ylabel("Marks")
plt.legend()
plt.grid(True)
plt.show()
✅ Project Overview
This project takes student data (Name, Subject, Marks), processes it using Pandas, and
visualizes it using Matplotlib.
📁 Project Structure
student_report/
Name,Subject,Marks
47
Praveen,Math,85
Praveen,Science,90
Aarthi,Math,78
Aarthi,Science,88
Ravi,Math,92
Ravi,Science,89
import pandas as pd
df = pd.read_csv('student_data.csv')
avg_marks = df.groupby('Name')['Marks'].mean().reset_index()
# Group by subject
subject_avg = df.groupby('Subject')['Marks'].mean().reset_index()
plt.figure(figsize=(8, 5))
plt.xlabel('Student')
plt.ylabel('Average Marks')
plt.grid(True)
48
plt.tight_layout()
plt.show()
plt.figure(figsize=(6, 4))
plt.xlabel('Subject')
plt.ylabel('Average Marks')
plt.grid(True)
plt.tight_layout()
plt.savefig("subject_avg.png")
plt.show()
Scope of Python
Python is a powerful, high-level, and versatile programming language with a wide range of
applications across industries. Here's a detailed look at the scope of Python:
1. Web Development
49
Use Cases: Automate boring tasks, file operations, data scraping, report generation
5. Game Development
50
Google makes extensive use of Python in its web search system, and employs
Python’s
creator.
Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for hardware
testing.
ESRI uses Python as an end-user customization tool for its popular GIS mapping
products.
51
52
53
54
Conclusion
Key areas such as data types, functions, object-oriented programming, file handling,
and GUI development were covered in detail. The mini project and final review
sessions helped reinforce the concepts and demonstrated how Python can be used for
automation, data analysis, and application development.
55
Appendix
Python 3.x
Jupyter Notebook / Google Colab
VS Code / PyCharm
Tkinter GUI library
Libraries: NumPy, Pandas, Matplotlib, Seaborn
Module Purpose
NumPy Numerical computations
Pandas Data manipulation and analysis
Matplotlib Data visualization
Tkinter GUI application development
OS, Sys System-level programming
📚 References
56