0% found this document useful (0 votes)
61 views56 pages

Niranjan

The document is an internship report submitted by Mr. Niranjan P for the Bachelor of Computer Applications degree at Sri Vidya Mandir Arts & Science College. It details a 15-day internship focused on Python programming, covering topics such as data types, control structures, and GUI development, culminating in a mini project. The report includes acknowledgments, an abstract, and a table of contents outlining the curriculum and learning outcomes.

Uploaded by

K. Pycho
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)
61 views56 pages

Niranjan

The document is an internship report submitted by Mr. Niranjan P for the Bachelor of Computer Applications degree at Sri Vidya Mandir Arts & Science College. It details a 15-day internship focused on Python programming, covering topics such as data types, control structures, and GUI development, culminating in a mini project. The report includes acknowledgments, an abstract, and a table of contents outlining the curriculum and learning outcomes.

Uploaded by

K. Pycho
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/ 56

An Internship Report Submitted to

Sri Vidya Mandir Arts & Science College (Autonomous)


In Partial Fulfillment of the Requirements for the Award of the Degree of

BACHELOR OF COMPUTER APPLICATIONS

Submitted by

Mr. NIRANJAN P
Register Number: 23UBCA063

(Duration: 06th May 2025 to 23rd May 2025)

PG & RESEARCH DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS

SRI VIDYA MANDIR ARTS & SCIENCE COLLEGE


(Autonomous)
[An Autonomous College Affiliated to Periyar University, Salem]
[Recognized under Section 2(f) & 12(B) of the UGC Act, 1956]
[Accredited by NAAC with “A” Grade [CGPA=3.27/4.00]]
VIGNESH NAGAR, KATTERI, UTHANGARAI - 636 902
KRISHNAGIRI (DT), TAMIL NADU
NOVEMBER – 2025
1
SRI VIDYA MANDIR ARTS & SCIENCE COLLEGE
(Autonomous)
[An Autonomous College Affiliated to Periyar University, Salem]
[Recognized under Section 2(f) & 12(B) of the UGC Act, 1956]
[Accredited by NAAC with “A” Grade [CGPA=3.27/4.00]]
VIGNESH NAGAR, KATTERI, UTHANGARAI - 636 902,
KRISHNAGIRI (DT), TAMIL NADU.

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.

Internship Supervisor Internal Guide

Date of Viva-voce Examination:

Head of the Department

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.

I am really grateful to convey my sincere gratitude to our Founder and Secretary


Thiru. V. CHANDRASEKARAN for his motivation and encouragement.

I offer my humble gratitude to our principal Dr. N. GUNASEKARAN, M.A.,


M.Phil., Ph.D., for permitting me to have my internship.

I wish to convey my deep sense of gratitude to Dr. D. KAVITHA, M.Sc., M.Phil.,


Ph.D., SET., Vice Principal & Head, PG & Research Department of Computer Science and
Applications, Sri Vidya Mandir Arts & Science College (Autonomous), Katteri, Uthangarai.

I express my deep sense of gratitude to my supervisor Dr. D. KAVITHA, M.Sc.,


M.Phil., Ph.D., SET., Assistant Professor, PG & Research Department of Computer Science
and Applications, Sri Vidya Mandir Arts and Science College (Autonomous), Katteri Who is
the source of inspiration which makes me to pursue this work successfully, I thank him for
his valuable guidance, encouragement and support in doing this internship.

I express my deep sense of gratitude to all mu department faculties those made me to


pursue this work successfully.

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 Python internship provided a comprehensive foundation in core programming concepts,


practical applications, and real-world software development using Python. Over the course of
15 days, the internship aimed to enhance programming skills by covering both fundamental
and advanced topics such as variables, data types, control structures, functions, modules, file
handling, object-oriented programming (OOP), and data manipulation using libraries like
NumPy and Pandas.

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

S.NO DATE TOPIC

1 06/05/2025 Introduction to Python and Installation

2 07/05/2025 Variables, Data Types, and Operators in Python

3 08/05/2025 Conditional Statements

4 09/05/2025 Loops in Python

5 10/05/2025 String and List in Python

6 12/05/2025 Functions and Modules in Python

7 13/05/2025 Tuples, Sets, and Dictionaries in Python

8 14/05/2025 File Handling in Python

9 15/05/2025 Object-Oriented Programming in Python

10 16/05/2025 GUI Programming in Python using Tkinter

11 17/05/2025 NumPy and Numerical Operations in Python

12 19/05/2025 Pandas – Data Manipulation in Python

13 20/05/2025 Matplotlib – Data Visualization in Python

14 21/05/2025 Mini Project development

15 22/05/2025 Scope Of Python

16 23/05/2025 Who Use Python Today?

17 Conclusion

18 Appendix&Reference

6
Introduction to Python and Installation
What is Python?

Python is a general-purpose, high-level programming language developed by Guido van


Rossum and officially released in 1991. The name "Python" was inspired by the British
comedy group Monty Python, not the snake.

Python is widely appreciated for its:

 Clean and readable syntax


 Vast standard libraries
 Cross-platform support

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.

Brief History of Python

Year Event

1980s Guido van Rossum begins developing Python


at Centrum Wiskunde & Informatica (CWI),
Netherlands

1991 .
Python 0.9.0 is released with classes,
exceptions, and core data types.

2000 Python 2.0 introduced list comprehensions


and garbage collection.

2008
Python 3.0 (also called "Python 3000")
released, not backward compatible with
Python 2.

2020 Python 2 officially retired.

2020 Today Python 3.x is the standard, with


regular updates and a huge global
community.

7
Key Features of Python
1. Easy to Learn and Use

Python’s syntax is clean, making it accessible to beginners.

2. Interpreted Language

Python executes code line-by-line using an interpreter, allowing faster debugging.

3. Dynamically Typed

No need to declare variable types; Python detects them automatically.

4. Extensive Standard Library

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.

6. Object-Oriented and Functional

Supports multiple programming paradigms.

7. Large Community Support

Millions of developers contribute to tutorials, forums, and libraries.

Applications of Python
Python is used in a wide variety of real-world applications:

Field Application Examples

Web Development Django, Flask frameworks

Data Science Pandas, NumPy, Scikit-learn

Machine Learning TensorFlow, Keras, PyTorch

Automation Scripts, Cron jobs

Desktop GUI Tkinter, PyQt

Game Development Pygame

8
Cybersecurity Scripting, penetration testing

IoT MicroPython for embedded systems

Variables, Data Types, and Operators in Python


What is a Variable?

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.

Python Variable Rules:

 Variable names are case-sensitive (name and Name are different).


 Must start with a letter or underscore _.
 Cannot start with a number.
 Cannot be a keyword (e.g., for, if, class).

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

x = "ten" # Now x is a string

Data Types in Python


In Python, a data type is a classification of data that determines the type of value it can
hold, the operations that can be performed on it, and the amount of memory it occupies.

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:

Type Description Example

int Integer values num = 10

float Decimal values price = 99.99

str String (text) msg = "Hello"

bool Boolean True/False flag = True

list Ordered mutable values a = [1, 2, 3]

tuple Ordered immutable values b = (1, 2, 3)

dict Key-value pairs d = {'name': 'John'}

set Unordered unique items s = {1, 2, 3}

Example 1: Declaring Different Data Types

name = "Python"

age = 25

pi = 3.14

is_valid = True

colors = ["red", "blue", "green"]

info = {"language": "Python", "version": 3.12}

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.

Python has several types of operators:

1. Arithmetic Operators:

- + (addition)

- - (subtraction)

- * (multiplication)

- / (division)

- ** (exponentiation)

- % (modulus)

2. Comparison Operators:

- == (equal to)

- != (not equal to)

- > (greater than)

- < (less than)

- >= (greater than or equal to)

- <= (less than or equal to)

3. Logical Operators:

- and (logical and)

- or (logical or)

- not (logical not)

4. Assignment Operators:

- = (assignment)

- += (addition assignment)

- -= (subtraction assignment)

- *= (multiplication assignment)

11
- /= (division assignment)

5. Membership Operators:

- in (check if value is in a sequence)

- not in (check if value is not in a sequence)

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

print(a < b) # True

print(a >= b) # False-

4.Logical Operators

x = 10

print(x > 5 and x < 15) # True

print(x > 20 or x == 10) # True

print(not(x == 10)) # False

5. Membership and Identity Operators

fruits = ["apple", "banana", "cherry"]

print("banana" in fruits) # True

print("grape" not in fruits) # True

x = [1, 2, 3]

y=x

z = [1, 2, 3]

print(x is y) # True

print(x is z) # False (different memory)

print(x == z) # True (same value)

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.

Why Use Conditional Statements?

Just like we make decisions in daily life:

> “If it rains, I will take an umbrella. Else, I won’t.”

Similarly, in Python:

if rain == True:

print("Take umbrella")

else:

print("No need for umbrella")

Types of Conditional Statements in Python

1. if Statement

Executes a block of code only if the condition is true.

Syntax:

if condition:

# block of code

Example:

age = 18

if age >= 18:

14
print("You are eligible to vote.")

Output:

You are eligible to vote.

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

if mark >= 40:

print("Pass")

else:

print("Fail")

Output:

Fail

3. if-elif-else Statement (Ladder)

When multiple conditions need to be checked one by one.

Syntax:

if condition1:

# block 1

elif condition2:

# block 2

15
else:

# final block

Example:

score = 75

if score >= 90:

print("Grade: A+")

elif score >= 75:

print("Grade: A")

elif score >= 60:

print("Grade: B")

else:

print("Grade: C")

Output:

Grade: A

4.Nested if Statements

An if statement inside another if or else block.

Example:

num = 10

if num > 0:

if num % 2 == 0:

print("Positive even number")

else:

print("Positive odd number")

else:

print("Non-positive number")

Output:

Positive even number

16
Example: Student Grade Evaluation System

Let’s build a mini grade calculator that:

 Takes student name, subject marks


 Calculates total and average
 Assigns grades based on average using if-elif-else
 Shows pass/fail status using if-else
 Displays results

Code:

# Student Grade Evaluation System

name = input("Enter student name: ")

math = int(input("Enter marks in Math: "))

science = int(input("Enter marks in Science: "))

english = int(input("Enter marks in English: "))

tamil = int(input("Enter marks in Tamil: "))

cs = int(input("Enter marks in Computer Science: "))

total = math + science + english + tamil + cs

average = total / 5

print("\n--- Result ---")

print("Name:", name)

print("Total Marks:", total)

print("Average Marks:", average)

# Grade Decision

if average >= 90:

grade = "A+"

elif average >= 80:

grade = "A"

elif average >= 70:

grade = "B"

elif average >= 60:


17
grade = "C"

elif average >= 50:

grade = "D"

else:

grade = "F"

print("Grade:", grade)

# Pass/Fail Decision

if average >= 40:

print("Result: Pass 🎉")

else:

print("Result: Fail 😞")

Output (Sample):

Enter student name: Ramesh

Enter marks in Math: 85

Enter marks in Science: 90

Enter marks in English: 88

Enter marks in Tamil: 92

Enter marks in Computer Science: 95

--- Result ---

Name: Ramesh

Total Marks: 450

Average Marks: 90.0

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:

> "Print numbers from 1 to 10"

Instead of writing 10 print() statements, we can use a loop!

Types of Loops in Python

Python supports two main types of loops:

Type Description

for loop Iterates over a sequence (list, string, range)

while loop Repeats a block of code as long as a


condition is true

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:

for item in sequence:

# block of code

Example 1: Loop through a list

fruits = ["apple", "banana", "cherry"]

for fruit in fruits:

print(fruit)

Output:
19
apple

banana

cherry

Example 2: Print numbers from 1 to 5

for i in range(1, 6):

print(i)

Output:

2. while Loop

The while loop runs as long as a condition is true.

Syntax:

while condition:

# block of code

Example: Count from 1 to 5

i=1

while i <= 5:

print(i)

i += 1

Output:

20
2

Loop Control Statements

Python provides the following statements to control loops:

Keyword Description

break Exits the loop immediately

continue Skips the current iteration and moves to next

pass Does nothing (used as placeholder)

Example with break

for i in range(1, 10):

if i == 5:

break

print(i)

Output:

Example with continue

for i in range(1, 6):

21
if i == 3:

continue

print(i)

Output:

Example with pass

for i in range(3):

pass # Placeholder for future code

Program: Number Guessing Game

import random

number = random.randint(1, 10)

guess = 0

while guess != number:

guess = int(input("Guess a number between 1 and 10: "))

if guess < number:

print("Too low! Try again.")

elif guess > number:

print("Too high! Try again.")

else:

print("Congratulations! You guessed it.")

Sample Output:

Guess a number between 1 and 10: 5

22
Too low! Try again.

Guess a number between 1 and 10: 8

Congratulations! You guessed it.

Difference Between for and while Loops

Feature for Loop while Loop

Used for Iterating over a sequence Repeating while a condition


is true

When to use Number of iterations is Number of iterations


known Unknown

Example for i in range(5) while i < 5:

String and List in Python


In Python, both strings and lists are sequence data types, meaning they store ordered
collections of items. However, they have distinct characteristics:

Strings:

Definition: A string is an immutable sequence of characters, enclosed in single quotes (') or


double quotes (").

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.

Purpose: Primarily used to represent and manipulate textual data.

Examples:

text1 = 'Hello'

text2 = "World"

text3 = """This is a

multi-line string"""

String Operations

Operation Example Result


23
Concatenation 'Hello' + ' World' Hello World

Repetition 'Hi' * 3 HiHiHi

Length len("Python") 6

Indexing "Python"[0] 'P'

Slicing "Python"[1:4] 'yth'

String Methods

Method Description Example


lower() Converts to lowercase "HELLO".lower() → hello

..upper() Converts to uppercase "hello".upper() → HELLO

.strip() Removes leading/trailing " hello ".strip()


spaces
.replace(a, b) Replaces character "hat".replace('h','c') → cat

.split() Splits string into list "a,b,c".split(',') → ['a','b','c']

String Example:

message = "Python Programming"

print("Length:", len(message))

print("First character:", message[0])

print("Slice:", message[7:18])

print("Uppercase:", message.upper())

Output:

Length: 18

First character: P

Slice: Programming

Uppercase: PYTHON PROGRAMMING

What is a List in Python?

24
A list is an ordered collection of items that is mutable (can be changed). Lists can store
multiple types of data.

Example:

fruits = ["apple", "banana", "cherry"]

numbers = [1, 2, 3, 4, 5]

mixed = ["apple", 100, True]

List Operations

Operation Example Output

Indexing fruits[1] 'banana'

Slicing fruits[0:2] ['apple', 'banana']

Append fruits.append("kiwi") ['apple','banana','cherry','kiwi']

Remove fruits.remove("banana") ['apple','cherry']

Insert fruits.insert(1,"grape") ['apple','grape','banana','cherry']

Length len(fruits) 3

List Example:

marks = [85, 90, 78, 92, 88]

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

Looping Through a List

25
fruits = ["apple", "banana", "cherry"]

for fruit in fruits:

print(fruit)

Output:

apple

banana

cherry

Nested Lists

Lists can contain other lists (like 2D arrays):

matrix = [

[1, 2, 3],

[4, 5, 6]

print(matrix[1][2]) # Output: 6

Functions and Modules in Python


What is a Function?

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

 Built-in Functions – Predefined by Python (e.g., print(), input(), len())


 User-defined Functions – Created by the programmer using the def keyword

Syntax

def function_name(parameters):

# code block

return result

Example 1: Greeting Function

26
def greet(name):

print("Hello", name)

greet("Praveen")

Example 2: Function with Return Value

def multiply(a, b):

return a * b

result = multiply(5, 4)

print("Result:", result)

Benefits of Using Functions

 Increases code reusability


 Improves readability
 Makes debugging easier

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

 Built-in Modules – Provided by Python (e.g., math, random, datetime)


 User-defined Modules – Python files created by the user

Example: Using a Built-in Module

import math

print("Square root of 16 is", math.sqrt(16))

Example: User-defined Module

27
File: myutils.py

def add(a, b):

return a + b

def subtract(a, b):

return a - b

Main Program:

import myutils

print("Addition:", myutils.add(10, 5))

print("Subtraction:", myutils.subtract(10, 5))

What I Learned

 How to define and use functions in Python


 How to pass arguments and return values
 How to import and use both built-in and custom modules
 The importance of modular programming for large projects

example. student_module.py (User-defined Module)

# student_module.py

students = {}

def add_student(name, marks):

students[name] = marks

def calculate_average(name):

if name in students:

return sum(students[name]) / len(students[name])

else:

return None

def get_topper():

28
topper = None

top_avg = 0

for name, marks in students.items():

avg = sum(marks) / len(marks)

if avg > top_avg:

top_avg = avg

topper = name

return topper, top_avg

def display_students():

print("\nStudent Records:")

for name, marks in students.items():

print(f"{name} => Marks: {marks}, Average: {calculate_average(name):.2f}")

2. main_app.py (Main Program)

# main_app.py

import student_module

# Adding students

student_module.add_student("Praveen", [85, 90, 92])

student_module.add_student("Aarthi", [78, 88, 84])

student_module.add_student("Ravi", [90, 95, 93])

# Displaying all students

student_module.display_students()

# Finding topper

topper_name, topper_avg = student_module.get_topper()

print(f"\nTopper is {topper_name} with an average of {topper_avg:.2f}")

Sample Output

29
Student Records:

Praveen => Marks: [85, 90, 92], Average: 89.00

Aarthi => Marks: [78, 88, 84], Average: 83.33

Ravi => Marks: [90, 95, 93], Average: 92.67

Topper is Ravi with an average of 92.67

Tuples, Sets, and Dictionaries in Python


Python offers several built-in data structures. Among them, Tuples, Sets, and Dictionaries are
very important for storing collections of data.

1. Tuples

What is a Tuple?

 A tuple is an ordered, immutable (unchangeable) collection of elements.


 Elements can be of different data types.
 Defined using parentheses ()

Syntax

my_tuple = (10, 20, 30)

Example

person = ("Praveen", 21, "India")

print(person[0]) # Output: Praveen

❗ Note:

Tuples cannot be changed (immutable):

person[0] = "Kumar" # ❌ Error: 'tuple' object does not support item assignment

When to Use Tuples?

 When you want to protect data from changes


 For fixed collections like coordinates, colors, etc.

2. Sets

30
What is a Set?

 A set is an unordered collection of unique elements.


 Defined using curly braces {} or the set() constructor.

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?

 A dictionary is an unordered collection of key-value pairs


 Defined using curly braces {} with : separating key and value

Syntax

my_dict = {"name": "Praveen", "age": 21, "country": "India"}

Example

student = {

"name": "Aarthi",

"age": 20,

"marks": [90, 85, 88]

}
31
print(student["name"]) # Output: Aarthi

student["age"] = 21 # Updating value

student["course"] = "Python" # Adding new key

Dictionary Methods

student.keys()

student.values()

student.items()

student.get("name")

student.pop("age")

When to Use Dictionaries?

 When you need key-based access


 For structured data (like user profile, config, etc.)

Real-World Example

# Tuple: Coordinates

location = (12.98, 77.58)

# Set: Unique email list

emails = {"a@gmail.com", "b@gmail.com", "a@gmail.com"} # No duplicates

# Dictionary: Student info

student = {

"name": "Ravi",

"age": 22,

"skills": ["Python", "SQL"]

File Handling in Python


What is File Handling?

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:

 Reading data from config files


 Logging
 Data processing and saving user input

File Operations in Python

Python provides built-in functions to perform various file operations like:

Operation Mode Description


Read 'r' Opens file for reading
(default)
Write 'w' Opens file for writing
(overwrites)
Append 'a' Opens file for appending
(adds to end)
Read + Write 'r+' Opens file for reading and
writing
Binary Modes 'rb', 'wb', 'ab' Works with binary files (like
images)

Basic File Handling Syntax

file = open("filename.txt", "mode")

# Do something with file

file.close()

Example 1: Writing to a File

file = open("example.txt", "w")

file.write("Hello, this is Python file handling.\n")

file.write("This is the second line.")

file.close()

Example 2: Reading from a File

file = open("example.txt", "r")

33
content = file.read()

print(content)

file.close()

Example 3: Appending to a File

file = open("example.txt", "a")

file.write("\nThis line is appended.")

file.close()

File Handling Functions

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

Object-Oriented Programming in Python


What is OOP?

Object-Oriented Programming (OOP) is a programming paradigm that organizes code into


objects—real-world entities like person, car, or student. Python supports OOP and allows
building reusable and modular code.

Key OOP Concepts in Python

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

1. Creating a Class and Object

class Student:

34
def _init_(self, name, age): # Constructor

self.name = name

self.age = age

def display(self):

print(f"Name: {self.name}, Age: {self.age}")

# Creating an object

s1 = Student("Praveen", 21)

s1.display()

🔍 Output:

Name: Praveen, Age: 21

2. Encapsulation

Example:

class BankAccount:

def _init_(self, balance):

self.__balance = balance # private variable

def deposit(self, amount):

self.__balance += amount

def get_balance(self):

return self.__balance

acc = BankAccount(1000)

acc.deposit(500)

print(acc.get_balance()) # Output: 1500

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

Example of Function Overriding:

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")

shapes = [Circle(), Square()]

for shape in shapes:

shape.area()

Real-World Example: Employee Management

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):

print(f"ID: {self.emp_id}, Name: {self.name}, Salary: {self.salary}")

e1 = Employee(101, "Praveen", 35000)

e2 = Employee(102, "Loki", 40000)

e1.show_details()

e2.show_details()

GUI Programming in Python using Tkinter


What is Tkinter?

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.

Key Features of Tkinter

 Simple and easy to use


 Comes pre-installed with Python
 Useful for building form-based apps, calculators, login screens, etc.

Basic Tkinter Program

import tkinter as tk

# Create main window

root = tk.Tk()

root.title("My First GUI")

root.geometry("300x200")

# Create a label widget

label = tk.Label(root, text="Hello, Tkinter!", font=("Arial", 16))

label.pack(pady=20)

37
# Start the GUI event loop

root.mainloop()

Common Tkinter Widgets

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

Example: Login Form

import tkinter as tk

def login():

user = username_entry.get()

pwd = password_entry.get()

if user == "admin" and pwd == "123":

result_label.config(text="Login Successful!", fg="green")

else:

result_label.config(text="Invalid Credentials", fg="red")

root = tk.Tk()

root.title("Login Form")

root.geometry("300x200")

# Username label and entry

tk.Label(root, text="Username:").pack(pady=5)

username_entry = tk.Entry(root)

username_entry.pack()

# Password label and entry

38
tk.Label(root, text="Password:").pack(pady=5)

password_entry = tk.Entry(root, show="*")

password_entry.pack()

# Login button

tk.Button(root, text="Login", command=login).pack(pady=10)

# Result label

result_label = tk.Label(root, text="")

result_label.pack()

root.mainloop()

NumPy and Numerical Operations in Python

What is NumPy?

NumPy (Numerical Python) is a powerful Python library used for:


 Scientific and numerical computing
 Working with arrays, matrices, and large datasets
 Performing fast mathematical operations

Installing NumPy

You can install NumPy using pip:

pip install numpy

Importing NumPy

import numpy as np

---

1. NumPy Arrays

Creating Arrays

39
import numpy as np

arr = np.array([1, 2, 3, 4, 5])

print(arr)

Array Types

 1D: np.array([1, 2, 3])


 2D: np.array([[1, 2], [3, 4]])
 3D: np.array([[[1], [2]], [[3], [4]]])

2. Array Attributes

arr = np.array([[1, 2, 3], [4, 5, 6]])

print(arr.shape) # (2, 3)

print(arr.ndim) #2

print(arr.size) #6

print(arr.dtype) # int64 (or int32)

3. Array Creation Functions

np.zeros((2, 3)) # 2x3 array of 0s

np.ones((3, 3)) # 3x3 array of 1s

np.eye(3) # 3x3 Identity matrix

np.arange(0, 10, 2) # [0 2 4 6 8]

np.linspace(0, 1, 5) # 5 values from 0 to 1

4. Basic Numerical Operations

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

A = np.array([[1, 2], [3, 4]])

B = np.array([[5, 6], [7, 8]])

# Matrix addition

print(A + B)

# Matrix multiplication

print(np.dot(A, B))

# Transpose

print(A.T)

6. Useful NumPy Functions

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

Real-World Example: Simple Stats Calculator

data = np.array([70, 85, 90, 75, 60])

print("Mean:", np.mean(data))

print("Max:", np.max(data))

print("Min:", np.min(data))

print("Standard Deviation:", np.std(data))

Pandas – Data Manipulation in Python


What is Pandas?

41
Pandas is a powerful open-source Python library used for:

 Data manipulation and analysis


 Handling tabular data (rows and columns)
 Reading/writing from files like CSV, Excel, JSON, SQL, etc.

Pandas is built on top of NumPy and works well for data wrangling, cleaning, filtering,
grouping, and analysis.

Installing Pandas

pip install pandas

Importing Pandas

import pandas as pd

1. Creating Data Structures

✅ Series (1D data)

import pandas as pd

s = pd.Series([10, 20, 30, 40])

print(s)

✅ DataFrame (2D table data)

data = {

'Name': ['Praveen', 'Aarthi', 'Ravi'],

'Marks': [85, 90, 78],

'Subject': ['Python', 'Math', 'Python']

df = pd.DataFrame(data)

print(df)

2. Reading and Writing Files

df = pd.read_csv("data.csv") # Reading CSV

42
df.to_csv("output.csv", index=False) # Writing CSV

df = pd.read_excel("data.xlsx") # Reading Excel

df.to_excel("output.xlsx", index=False) # Writing Excel

3. Basic DataFrame Operations

df.head() # First 5 rows

df.tail() # Last 5 rows

df.shape # Rows and columns

df.columns # List of column names

df.info() # Summary of data

df.describe() # Statistics (mean, std, etc.)

4. Selecting and Filtering Data

✅ Select a column

df['Name'] # As Series

df[['Name', 'Marks']] # Multiple columns

✅ Filter rows (conditions)

df[df['Marks'] > 80]

df[df['Subject'] == 'Python']

5. Modifying Data

✅ Add a new column

df['Result'] = ['Pass', 'Pass', 'Fail']

✅ Update existing data

df.loc[1, 'Marks'] = 95 # Update value at row 1, column 'Marks'

✅ Delete a column

df.drop('Subject', axis=1, inplace=True)

43
Example: Student Data Analysis

data = {

'Name': ['Asha', 'Mani', 'John', 'Asha'],

'Subject': ['Math', 'Math', 'Science', 'Math'],

'Marks': [85, 78, 90, 92]

df = pd.DataFrame(data)

# Average marks per subject

print(df.groupby('Subject')['Marks'].mean())

# Students who scored more than 80

print(df[df['Marks'] > 80])

Matplotlib – Data Visualization in Python


What is Matplotlib?

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.

1. Basic Line Plot

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]

y = [10, 20, 25, 30, 40]

plt.plot(x, y)

plt.title("Basic Line Plot")

plt.xlabel("X-axis")

plt.ylabel("Y-axis")

plt.grid(True)

44
plt.show()

2. Bar Chart

names = ['Praveen', 'Aarthi', 'Ravi']

marks = [85, 90, 75]

plt.bar(names, marks, color='skyblue')

plt.title("Student Marks")

plt.xlabel("Students")

plt.ylabel("Marks")

plt.show()

3. Pie Chart

subjects = ['Math', 'Science', 'English']

scores = [40, 30, 30]

plt.pie(scores, labels=subjects, autopct='%1.1f%%', startangle=140)

plt.title("Subject Score Distribution")

plt.show()

4. Histogram

import numpy as np

data = np.random.normal(70, 10, 100) # 100 values, mean=70, std=10

plt.hist(data, bins=10, color='green')

plt.title("Histogram of Scores")

plt.xlabel("Score")

plt.ylabel("Frequency")

plt.show()

45
5. Scatter Plot

x = [10, 20, 30, 40, 50]

y = [5, 15, 25, 35, 45]

plt.scatter(x, y, color='red')

plt.title("Scatter Plot Example")

plt.xlabel("X Data")

plt.ylabel("Y Data")

plt.show()

🔷6. Multiple Plots in One Graph

x = [1, 2, 3, 4, 5]

y1 = [1, 4, 9, 16, 25]

y2 = [1, 2, 3, 4, 5]

plt.plot(x, y1, label="Squares")

plt.plot(x, y2, label="Linear", linestyle='--')

plt.title("Multiple Line Plot")

plt.xlabel("X")

plt.ylabel("Y")

plt.legend()

plt.show()

🔷7. Customize Plot Appearance

plt.plot(x, y1, color='orange', marker='o', linestyle='--', linewidth=2)

plt.title("Customized Plot")

plt.xlabel("X Axis")

plt.ylabel("Y Axis")

plt.grid(True)

46
plt.show()

Example Mini Project: Student Marks Visualizer

students = ['John', 'Anna', 'Mike']

math = [85, 78, 92]

science = [88, 84, 89]

plt.plot(students, math, label='Math', marker='o')

plt.plot(students, science, label='Science', marker='s')

plt.title("Student Performance")

plt.xlabel("Student")

plt.ylabel("Marks")

plt.legend()

plt.grid(True)

plt.show()

Mini Project development


Student Marks Report Generator

✅ Project Overview

This project takes student data (Name, Subject, Marks), processes it using Pandas, and
visualizes it using Matplotlib.

📁 Project Structure

student_report/

├── student_data.csv ← Input file (CSV)

├── report_generator.py ← Main Python program

1. Sample Data – student_data.csv

Name,Subject,Marks

47
Praveen,Math,85

Praveen,Science,90

Aarthi,Math,78

Aarthi,Science,88

Ravi,Math,92

Ravi,Science,89

2. Python Code – report_generator.py

import pandas as pd

import matplotlib.pyplot as plt

# Load CSV data

df = pd.read_csv('student_data.csv')

# Display raw data

print("\n📋 Student Data:\n", df)

# Group by student and calculate average marks

avg_marks = df.groupby('Name')['Marks'].mean().reset_index()

print("\n📈 Average Marks:\n", avg_marks)

# Group by subject

subject_avg = df.groupby('Subject')['Marks'].mean().reset_index()

print("\n📊 Subject-Wise Average:\n", subject_avg)

# Plotting student-wise average marks

plt.figure(figsize=(8, 5))

plt.bar(avg_marks['Name'], avg_marks['Marks'], color='lightgreen')

plt.title('Student-Wise Average Marks')

plt.xlabel('Student')

plt.ylabel('Average Marks')

plt.grid(True)

48
plt.tight_layout()

plt.savefig("student_avg.png") # Save as image

plt.show()

# Plotting subject-wise marks

plt.figure(figsize=(6, 4))

plt.bar(subject_avg['Subject'], subject_avg['Marks'], color='skyblue')

plt.title('Subject-Wise Average Marks')

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

 Frameworks: Django, Flask, FastAPI


 Applications: Websites, web apps, APIs
 Features: Rapid development, secure, scalable

2. Data Science & Analytics

 Libraries: NumPy, Pandas, Matplotlib, Seaborn, SciPy


 Use Cases: Data cleaning, data visualization, statistical analysis, business intelligence

3. Machine Learning & Artificial Intelligence

 Libraries: Scikit-learn, TensorFlow, Keras, PyTorch


 Applications: Predictive models, computer vision, NLP, recommendation systems

4. Automation & Scripting

 Tools: Selenium, PyAutoGUI, BeautifulSoup

49
 Use Cases: Automate boring tasks, file operations, data scraping, report generation

5. Game Development

 Libraries: Pygame, Panda3D


 Applications: 2D games, educational games, prototyping

6. GUI Application Development

 Libraries: Tkinter, PyQt, Kivy


 Use Cases: Desktop apps, small tools, education-based software

7. Cybersecurity and Ethical Hacking

 Tools: Scapy, Nmap, Requests, Paramiko


 Applications: Network scanning, vulnerability detection, automation of attacks

8. Internet of Things (IoT)

 Libraries: MicroPython, CircuitPython


 Use Cases: Sensor data collection, smart devices, automation systems

9. Cloud Computing & DevOps

 Tools: Ansible, Docker SDK for Python, AWS Boto3


 Use Cases: Deployment automation, infrastructure management

10. Education & Research

 Simplicity and readability make Python ideal for learning programming.


 Used for scientific computing, simulations, and academic research.

WHO USES PYTHON TODAY?

 Python is being applied in real revenue-generating products by real companies.

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.

WHY DO PEOPLE USE PYTHON?

 The YouTube video sharing service is largely written in Python.


 Python is object-oriented o Structure supports such concepts as
 polymorphism, operation overloading, and multiple inheritance.
 Indentation o Indentation is one of the greatest future in Python.
 It's free (open source) o Downloading and installing Python is free
 and easy o Source code is easily accessible
 It's powerful o Dynamic typing o Built-in types and tools o Library
 utilities
 Third party utilities (e.g. Numeric, NumPy, SciPy) o
 Automatic memory management
 It's portable o Python runs virtually every major platform used
 today o As long as you have a compatible Python interpreter
 installed, Python programs will run in exactly the same manner,
 irrespective of platform.

51
52
53
54
Conclusion

The 15-day Python internship provided a strong foundation in Python programming,


from basic syntax to advanced modules like NumPy, Pandas, and Matplotlib. Through
hands-on practice, I gained confidence in writing efficient Python code for real-world
applications.

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.

This internship has significantly enhanced my problem-solving abilities and technical


skills, preparing me for more advanced Python development and real-time projects. It
has also sparked a strong interest in pursuing further learning in machine learning and
data science using Python.

55
Appendix

A. Tools & Software Used

 Python 3.x
 Jupyter Notebook / Google Colab
 VS Code / PyCharm
 Tkinter GUI library
 Libraries: NumPy, Pandas, Matplotlib, Seaborn

B. Key Python Libraries Practiced

Module Purpose
NumPy Numerical computations
Pandas Data manipulation and analysis
Matplotlib Data visualization
Tkinter GUI application development
OS, Sys System-level programming

📚 References

1. Python Official Documentation


https://docs.python.org/3/

2. W3Schools Python Tutorial


https://www.w3schools.com/python/

3. GeeksforGeeks - Python Programming Language


https://www.geeksforgeeks.org/python-programming-language/

4. TutorialsPoint - Python Basics


https://www.tutorialspoint.com/python/

5. Python Crash Course Book by Eric Matthes


6. Notes and guidance provided by the SRM Infotech Tirupattur internship trainer.

56

You might also like