Anand First Page
Anand First Page
Degree of
Bachelors of Technology
In
i
INDUSTRIAL INTERNSHIP 4 MONTHS REPORT
2025
ii
CERTIFICATE
EXTERNAL EXAMINER
iii
ACCEPTANCE LETTER FROM SKILLDZIRE
ORGANIZATION
iv
CERTIFICATE FROM INTERN ORGANIZATION
v
DECLARATION
Date: (21NT1A0458)
vi
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to all those who have
supported and guided me throughout my Python Course internship. My
heartfelt thanks to Skill Dzire Organization for providing me with the
opportunity to work and enhance my skills in the field of Python course. I am
deeply thankful to Visakha Institute of Engineering & Technology (VIET)
for offering a supportive environment that made this experience possible. I
extend my sincere appreciation to Dr. G. Satyanarayana, Chairman of VIET,
for his visionary leadership, and Dr. G.V. Pradeep Varma, Principal of VIET,
for his continuous encouragement. I would also like to thank Dr. D. Santha
Rao, Dean of Academics, for his insightful guidance, and Dr. P. Varma,
Training and Placement Officer (TPO), for his efforts in facilitating this
internship. My thanks are also due to Dr. B. Jeevana Rao, Head of the
Department of Electronics and Communication Engineering (ECE), for his
academic support. I am especially grateful to my Project Guide, Mrs. K.
KANTHI KINNERA M. tech, (Ph . D), for her valuable mentorship, constant
encouragement, and expert guidance throughout the internship. Additionally,
I would like to acknowledge the faculty members of the ECE department
whose teachings and support have played a crucial role in my academic
development.
vii
ABSTRACT
Data science encompasses a set of principles, problem definitions, algorithms,
and processes for extracting nonobvious and useful patterns from large data
sets. Many of the elements of data science have been developed in related
fields such as machine learning and data mining. In fact, the terms data
science, machine learning, and data mining are often used interchangeably.
The commonality across these disciplines is a focus on improving decision
making through the analysis of data. However, although data science borrows
from these other fields, it is broader in scope. Machine learning (ML) focuses
on the design and evaluation of algorithms for extracting patterns from data.
Data mining generally deals with the analysis of structured data and often
implies an emphasis on commercial applications. Data science takes all of
these considerations into account but also takes up other challenges, such as
the capturing, cleaning, and transforming of unstructured social media and
web data; the use of big-data technologies to store and process big,
unstructured data sets; and questions related to data ethics and regulation.
viii
CONTENTS
S.NO Name of the Topic/Chapter Page No. From
To
ix
Operators 17
Strings in Python 19
6 Functions and Scope in Python 24-26
Functions of Python 24
Scopes of python 25
7 Packages & Modules in Python 27-29
8 Exception Handling in Python 30-32
9 Python Data Structures Overview 33-35
10 Lists, Strings, Sets, Tuples, and Dictionaries in 36-39
Python
11 Files and File Handling in Python 40-41
12 Regular Expressions in Python 42-43
13 CONCLUSION 44
x
CHAPTER 1
INTRODUCTION TO AI
Fig1.0
Fig1.1
1
1.3 Types of Artificial Intelligence:
Artificial intelligence can be organized in several ways, depending on
stages of development or actions being performed.
Fig 1.2
2
1.4 Artificial Intelligence Training Models:
Supervised learning is a machine learning model that maps a specific
input to an output using labelled training data (structured data).
Fig 1.3
3
1.5 Benefits of AI:
Fig 1.4
1.6 Applications of AI:
Fig 1.5
4
CHAPTER : 2
What is Data Science
Data Science is a combination of multiple disciplines that uses statistics,
data analysis, and machine learning to analyse data and to extract
knowledge and insights from it.
Data Science is about finding patterns in data, through analysis, and make
future predictions.
Data Science can be applied in nearly every part of a business where data is
available. Examples are:
Consumer goods
Stock markets
Industry
Politics
Logistic companies
E-commerce
5
One purpose of Data Science is to structure data, making it
interpretable and easy to work with.
Structured data
Unstructured data
Fig 2.1
2.3 How Does a Data Scientist Work:
A Data Scientist requires expertise in several backgrounds:
Machine Learning
Statistics
Programming (Python or R)
Mathematics
Databases
6
Fig 2.2
1. Problem Statement:
2. Data Collection:
3. Data Cleaning:
As you have formulated your motive and also you did collect your data,
the next step to do is cleaning. Yes, it is! Data cleaning is the most
favourite thing for data scientists to do. Data cleaning is all about the
removal of missing, redundant, unnecessary and duplicate data from
your collection. There are various tools to do so with the help of
programming in either R or Python. It’s totally on you to choose one of
them. Various scientist has their opinion on which to choose. When it
comes to the statistical part, R is preferred over Python, as it has the
privilege of more than 12,000 packages. While python is used as it is
fast, easily accessible and we can perform the same things as we can in
R with the help of various packages.
7
It’s one of the prime things in data science to do and time to get inner
Holmes out. It’s about analysing the structure of data, finding hidden
patterns in them, studying behaviours, visualizing the effects of one
variable over others and then concluding. We can explore the data with
the help of various graphs formed with the help of libraries using any
programming language. In R, GGplot is one of the most famous models
while Matplotlib in Python.
5. Data Modelling:
Once you are done with your study that you have formed from data
visualization, you must start building a hypothesis model such that it
may yield you a good prediction in future. Here, you must choose a good
algorithm that best fit to your model. There different kinds of algorithms
from regression to classification, SVM (Support vector machines),
Clustering, etc. Your model can be of a Machine Learning algorithm.
You train your model with the train data and then test it with test data.
There are various methods to do so. One of them is the K-fold method
where you split your whole data into two parts, one is Train and the
other is test data. On these bases, you train your model.
You followed each and every step and hence build a model that you feel
is the best fit. But how can you decide how well your model is
performing? This where optimization comes. You test your data and find
how well it is performing by checking its accuracy. In short, you check
the efficiency of the data model and thus try to optimize it for better
accurate prediction. Deployment deals with the launch of your model
and let the people outside there to benefit from that. You can also obtain
feedback from organizations and people to know their need and then to
work more on your model.
Fig 2.3
8
CHAPTER : 3
Machine Learning concepts and Applications
Machine learning (ML) allows computers to learn and make decisions without
being explicitly programmed. It involves feeding data into algorithms to
identify patterns and make predictions on new data. Machine learning is used
in various applications, including image and speech recognition, natural
language processing, and recommender systems.
9
3.3 Importance of Data in Machine Learning:
Data is the foundation of machine learning (ML). Without quality data,
ML models cannot learn, perform, or make accurate predictions.
Fig 3.0
Fig 3.1
10
CHAPTER : 4
PYTHON
Python is a programming language widely used by Data Scientists.
Fig 4.1
Fig 4.2
11
4.3 Key Libraries and Tools:
NumPy: A fundamental library for numerical operations in Python,
supporting large, multi-dimensional arrays and matrices.
Fig 4.3
Fig 4.4
12
4.5 Applications of Python:
Fig 4.5
Benefits of Python:
Fig 4.6
Fig 4.7
13
CHAPTER: 5
Python Syntax, Data Types & Operators
Python is known for its clean and readable syntax, which makes it an
excellent language for beginners and professionals working in AI, data
science, and software development.
Comments start with # and are ignored by the interpreter. Use them to explain
your code.
Variables do not require a type declaration; the type is inferred from the value
(e.g., x = 10).
Functions are defined using the def keyword, and blocks of code are
structured using colons (:) followed by indented lines.
Control structures like if, elif, else, for, and while are written in a natural,
readable way.
Example:
# This is a comment
def greet(name):
if name:
else:
14
print ("Hello, Guest!")
greet("Alice")
Python also supports a REPL (Read-Eval-Print Loop) mode, where you can
type Python code line by line and see immediate results. This makes it great
for quick testing and learning. Overall, Python's syntax emphasizes
readability, simplicity, and consistency, which is why it's so widely loved by
beginners and professionals alike.
Fig 5.1
15
◆ 1. Numeric Types
These include:
◆ 2. Sequence Types
◆ 3. Set Types
◆ 4. Mapping Type
◆ 5. Boolean Type
◆ 6. Binary Types
16
◆ 7. None Type
Example:
a = 10 # int
b = 3.14 # float
c = "Python" # str
d = [1, 2, 3] # list
e = {"key": 1} # dict
f = True # bool
Python also allows you to check the type of a variable using the built-in type()
function, and you can convert between types using type casting, such as int(),
float(), str(), etc. Understanding data types is foundational for writing correct
Python code, as operations and functions behave differently depending on the
type of data they work with.
5.3 Operators:
In Python, operators are special symbols or keywords used to perform
operations on variables and values. Python supports several types of
operators that enable arithmetic operations, comparisons, logical decisions,
bitwise manipulations, and more. These operators make it easier to write
expressions that carry out calculations and control flow in programs.
1. Arithmetic Operators
Example:
a=5
b=2
print (a + b) # 7
print (a ** b) # 25
17
Used to compare values and return a boolean result:
>= (Greater than or equal to), <= (Less than or equal to)
Example:
x = 10
y = 20
3. Logical Operators
Example:
a=5
4. Assignment Operators
Example:
x=5
x += 3 # x becomes 8
5. Bitwise Operators
18
Example:
a=5 # 0101
b=3 # 0011
6. Membership Operators
Example:
7. Identity Operators
Example:
x = [1, 2, 3]
y=x
print (x is y) # True
◆ Conditional Statements
These statements let your program make decisions based on certain
conditions. Python uses:
19
if – executes a block if the condition is true
Example:
x = 10
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
◆ Looping Statements
Loops are used to repeat a block of code multiple times.
Examples:
# for loop
for i in range (5):
print(i)
# while loop
i=0
while i < 5:
print(i)
i += 1
20
pass – does nothing, used as a placeholder
Example:
Python offers many powerful string methods to work with text, such as:
21
strip () – removes whitespace from both ends
Example:
word = "Python"
Python also supports string formatting, which allows you to embed variables
into strings:
22
There are basically 3 types of operators supported by string:
Basic Operators: There are two types of basic operators in string. They are
“+” and “*”.
1. Concatenation Operator (+): the concatenation operator concatenates
two strings and forms a new string.
2. Replication Operator (*): It is used to repeat a string number of times
the string will be repeated the number of times is given by the integer
value.
Membership operators: To test whether a value is present in a sequence.
Relational Operators: All the comparisons operators i.e., (<,>, <=,>=, == ,!=,
<>)
Slice Notation: String Slice can be defined as substring which is the part of
string. Therefore, further substring can be obtained from a string.
Strings in Python are versatile and essential, used in everything from simple
output messages to file handling, data parsing, and user input. Their
flexibility and the wide range of methods make them one of the most
important data types in Python.
23
CHAPTER:6
Functions and Scope in Python
In Python: functions, modules, and exception handling. These concepts help
developers write organized, reusable, and error-free code, making Python a
powerful and efficient programming language for AI, data science, and
software development.
• Built-in Functions such as print (), len (), and range ().
keyword.
• Lambda Functions, which are small anonymous functions used for quick,
short operations.
Example:
def greet(name):
Python also supports default arguments, where parameters can have default
values:
24
python
Copy
Edit
def greet(name="Guest"):
Python also allows anonymous functions using the lambda keyword. These
are short, one-line functions used for simple tasks, especially with functions
like map (), filter (), and sorted ().
Example:
square = lambda x: x * x
Local scope:
Variables declared within a function have local scope. They are
accessible only within the function in which they are defined.
Local variables are created when the function is called and
destroyed when it exits.
Local variables cannot be accessed from outside the function.
25
Global Scope:
Variables declared outside of any function or at the top level of a
script have global scope. They are accessible throughout the
program.
During program startup, global variables are created in memory
and remain there until the program ends.
Global variables can be accessed from any function within the
program.
Nested scope:
Python allows nested functions, where one function is defined
inside another.
During nested functions, the inner function has access to
variables in the outer (enclosed) function.
The inner function's scope is called "nested scope" because it
includes both its local scope and the enclosing function's scope.
26
CHAPTER: 7
Packages and Modules in Python
Introduction
Python is a high-level, general-purpose programming language widely used in
various domains including data science, machine learning, web development,
and automation. One of Python’s key strengths is its modular structure,
which allows developers to organize code into reusable components. This
modularity is achieved through the use of modules and packages, which play
a vital role in organizing, maintaining, and scaling Python projects effectively.
Modules in Python
A module is a file containing Python code that is written for reuse. It typically
consists of functions, classes, and variables that serve specific functionalities.
The primary goal of a module is to break down large programs into smaller,
manageable, and logically organized parts. This enhances code readability,
promotes reuse, and simplifies debugging and maintenance.
Modules form the foundational building blocks of Python programs. They can
be standard (built-in to Python), third-party (installed externally), or user-
defined (created by the developer). Using modules also allows for separation
of concerns, where each module is responsible for a specific part of the
program logic, reducing complexity in large codebases.
27
Packages in Python
A package is a hierarchical file structure that contains multiple modules
grouped together to form a collection of related functionalities. Packages allow
developers to organize their modules into directories, thereby creating a
scalable project structure. The presence of a special initialization file in the
directory indicates to Python that it should treat the directory as a package.
Packages are essential when working on large projects that involve multiple
components. By categorizing similar modules into packages, developers can
avoid naming conflicts, improve code organization, and enable better
navigation through the codebase. Packages can also contain sub-packages,
allowing for multi-level structuring of code.
28
repetitive processes, and collaborate effectively in a team environment. This
approach not only improved the quality of the code but also enhanced overall
productivity.
Modules in Python are essential components that allow programmers to
organize code into separate files and reuse functionality across different
programs. A module is simply a file containing Python code—such as
functions, classes, or variables—that can be imported and used in another
Python script. Python supports various types of modules, including built-in
modules like math, os, and datetime, which come pre-installed and provide
powerful features for mathematical operations, file handling, and date/time
manipulation. Users can also create their own custom modules, known as
user-defined modules, to structure their code better and enhance reusability.
Additionally, third-party modules like numpy, pandas, matplotlib, and flask
can be installed using Python’s package manager pip to perform specific tasks
such as data analysis, visualization, and web development. Modules can be
imported using the import statement, and specific functions or classes can be
brought in using from module import name. By using modules, Python
promotes modular programming, which leads to cleaner, more manageable
code, encourages reusability, reduces redundancy, and improves overall
program structure. Whether for small scripts or large applications, modules
play a vital role in efficient and effective Python development.
29
CHAPTER: 8
EXCEPTION HANDLING IN PYTHON
Introduction
In any programming language, errors are a natural part of the development
process. Python provides a structured way to detect and handle these errors
using a mechanism called exception handling. This allows programs to
respond to unexpected situations without crashing, thereby improving
robustness, user experience, and overall software reliability.
Understanding Exceptions
An exception is an event that occurs during the execution of a program that
disrupts the normal flow of instructions. Exceptions are not necessarily errors
in logic; they often result from conditions that are beyond the control of the
program, such as attempting to access a file that does not exist or dividing a
number by zero.
In Python, exceptions are objects that represent these error conditions. When
an exception occurs, Python immediately stops the current flow of the
program and looks for a way to handle the exception. If not handled, the
program terminates and displays an error message, commonly referred to as
a traceback.
30
An optional block for cleanup actions.
This mechanism provides flexibility and control over how different types of
exceptions are managed and ensures that the program can continue running
or exit gracefully.
Error Isolation: Helps identify exactly where the error occurred without
affecting the rest of the code.
31
During my internship in the field of data science, I encountered several
scenarios where exception handling became necessary—for instance, when
handling missing values, managing file loading issues, or connecting to
external databases. Implementing structured exception handling helped me
build resilient scripts that could run reliably in different environments with
varying data inputs.
Conclusion
Exception handling is a fundamental aspect of writing robust and
professional-grade Python applications. It allows developers to anticipate and
manage errors effectively, ensuring that programs behave predictably even
under unexpected conditions. In data science and other real-world
applications, the ability to handle exceptions gracefully not only improves
performance but also enhances the reliability and trustworthiness of the
system. My internship experience underscored the importance of mastering
exception handling to create stable, scalable, and user-friendly Python
solutions.
32
CHAPTER: 9
PYTHON DATA STRCTURES
Introduction
Data structures are the foundational building blocks of any programming
language. In Python, data structures are used to store, organize, and manage
data efficiently. They provide a means of performing operations on data and
are essential for solving complex computational problems. Python offers a rich
collection of built-in data structures that are both flexible and easy to use,
which makes the language especially powerful for data science and software
development.
Integers
Floats
Strings
Booleans
While not considered data structures in the traditional sense, these primitives
form the basis for more complex types.
These include more advanced structures that are capable of storing multiple
elements and performing operations on them. The primary non-primitive data
structures in Python are:
33
Dictionaries: Key-value pairs for efficient lookup and storage.
Python’s built-in data structures are often used in combination with third-
party libraries like pandas, which extends their functionality for handling
structured data such as tables and time series.
Ease of Use: The syntax and operations associated with Python’s data
structures are intuitive and user-friendly.
34
Tasks such as data cleaning, transformation, and aggregation were greatly
facilitated by using dictionaries, lists, and sets. Understanding the underlying
structure of data allowed me to implement faster and more reliable solutions,
especially when dealing with large-scale operations or real-time data.
Data structures also supported integration with various tools and libraries,
enabling seamless development of end-to-end data workflows.
35
Chapter:10
Lists, Tuples, Sets, Dictionaries and Strings in
Python
List
A list in Python is a dynamic, ordered collection that can store elements of
different data types such as integers, floats, strings, or even other lists (nested
lists). Lists are mutable, so you can change, add, or delete elements without
creating a new list. They are defined using square brackets []. Lists are
versatile and widely used for storing a sequence of items such as a list of
student names, shopping items, or daily temperatures.
Example:
print(fruits)
String
A string is a sequence of Unicode characters used to represent text. Strings
are immutable, meaning once created, their content cannot be changed. You
can perform various operations on strings like slicing, searching, formatting,
and joining. Strings are defined using single ' or double " quotes, and multiline
strings use triple quotes ''' or """.
36
replace () – replaces part of the string
Example:
python
Tuple
A tuple is a collection similar to a list but immutable, meaning once it's
created, you cannot add, remove, or change elements. Tuples are defined
using parentheses (). Because they are immutable, they can be used as
dictionary keys or elements in a set, which lists cannot do. Tuples are
usually used when the data should not be changed throughout the program,
like coordinates (x, y) or months of the year.
Common operations:
Example:
python
Output = 20
Advantages:
Dictionary
A dictionary is an unordered, mutable collection of key-value pairs. Each
key must be unique and immutable (like strings, numbers, or tuples).
Dictionaries are written using curly braces {}. They are commonly used to
store data like student records, configurations, or any structured data.
37
Common methods:
Example:
python
print(student["name"])
Output = Alice
Use Cases:
Set
A set is a collection of unordered, unique items. Sets are useful when you
want to ensure there are no duplicate entries. Sets are mutable, meaning you
can add or remove elements, but they do not support indexing or slicing
because they are unordered. Sets are ideal for operations like union,
intersection, and difference between groups.
Common methods:
Example:
python
set1 = {1, 2, 3}
38
set2 = {3, 4, 5}
Output = {3}
39
Chapter: 11
Files and File Handling in Python
Files and File Handling in Python
In Python, file handling allows you to create, read, write, and delete files
directly from your Python program. This is especially useful when you want
to store data permanently, process text files, or interact with external files like
logs, reports, or configurations. Python provides built-in functions for file
handling, and the most common one is the open () function. This function is
used to open a file and returns a file object, which lets you perform various
operations on the file.
Add "b" for binary mode (e.g., "rb" for read binary)
To write to a file, use write () or writelines (). After you're done working with a
file, it’s important to close it using close () to free up system resources.
However, the better way to handle files in Python is using a with block (also
called a context manager), which automatically closes the file when done.
Example (writing and reading a file):
python
# Writing to a file
file.write("Python is fun!")
40
# Reading from a file
content = file.read()
print(content)
41
INDUSTRIAL INTERNSHIP 4 MONTHS REPORT
2025
ii
CERTIFICATE
EXTERNAL EXAMINER
iii
ACCEPTANCE LETTER FROM SKILLDZIRE
ORGANIZATION
iv
CERTIFICATE FROM INTERN ORGANIZATION
v
DECLARATION
Date: (21NT1A0458)
vi
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to all those who have
supported and guided me throughout my Python Course internship. My
heartfelt thanks to Skill Dzire Organization for providing me with the
opportunity to work and enhance my skills in the field of Python course. I am
deeply thankful to Visakha Institute of Engineering & Technology (VIET)
for offering a supportive environment that made this experience possible. I
extend my sincere appreciation to Dr. G. Satyanarayana, Chairman of VIET,
for his visionary leadership, and Dr. G.V. Pradeep Varma, Principal of VIET,
for his continuous encouragement. I would also like to thank Dr. D. Santha
Rao, Dean of Academics, for his insightful guidance, and Dr. P. Varma,
Training and Placement Officer (TPO), for his efforts in facilitating this
internship. My thanks are also due to Dr. B. Jeevana Rao, Head of the
Department of Electronics and Communication Engineering (ECE), for his
academic support. I am especially grateful to my Project Guide, Mrs. K.
KANTHI KINNERA M. tech, (Ph . D), for her valuable mentorship, constant
encouragement, and expert guidance throughout the internship. Additionally,
I would like to acknowledge the faculty members of the ECE department
whose teachings and support have played a crucial role in my academic
development.
vii
ABSTRACT
Data science encompasses a set of principles, problem definitions, algorithms,
and processes for extracting nonobvious and useful patterns from large data
sets. Many of the elements of data science have been developed in related
fields such as machine learning and data mining. In fact, the terms data
science, machine learning, and data mining are often used interchangeably.
The commonality across these disciplines is a focus on improving decision
making through the analysis of data. However, although data science borrows
from these other fields, it is broader in scope. Machine learning (ML) focuses
on the design and evaluation of algorithms for extracting patterns from data.
Data mining generally deals with the analysis of structured data and often
implies an emphasis on commercial applications. Data science takes all of
these considerations into account but also takes up other challenges, such as
the capturing, cleaning, and transforming of unstructured social media and
web data; the use of big-data technologies to store and process big,
unstructured data sets; and questions related to data ethics and regulation.
viii
CONTENTS
S.NO Name of the Topic/Chapter Page No. From
To
ix
Operators 17
Strings in Python 19
6 Functions and Scope in Python 24-26
Functions of Python 24
Scopes of python 25
7 Packages & Modules in Python 27-29
8 Exception Handling in Python 30-32
9 Python Data Structures Overview 33-35
10 Lists, Strings, Sets, Tuples, and Dictionaries in 36-39
Python
11 Files and File Handling in Python 40-41
12 Regular Expressions in Python 42-43
13 CONCLUSION 44
x
CHAPTER 1
INTRODUCTION TO AI
Fig1.0
Fig1.1
1
1.3 Types of Artificial Intelligence:
Artificial intelligence can be organized in several ways, depending on
stages of development or actions being performed.
Fig 1.2
2
1.4 Artificial Intelligence Training Models:
Supervised learning is a machine learning model that maps a specific
input to an output using labelled training data (structured data).
Fig 1.3
3
1.5 Benefits of AI:
Fig 1.4
1.6 Applications of AI:
Fig 1.5
4
CHAPTER : 2
What is Data Science
Data Science is a combination of multiple disciplines that uses statistics,
data analysis, and machine learning to analyse data and to extract
knowledge and insights from it.
Data Science is about finding patterns in data, through analysis, and make
future predictions.
Data Science can be applied in nearly every part of a business where data is
available. Examples are:
Consumer goods
Stock markets
Industry
Politics
Logistic companies
E-commerce
5
One purpose of Data Science is to structure data, making it
interpretable and easy to work with.
Structured data
Unstructured data
Fig 2.1
2.3 How Does a Data Scientist Work:
A Data Scientist requires expertise in several backgrounds:
Machine Learning
Statistics
Programming (Python or R)
Mathematics
Databases
6
Fig 2.2
1. Problem Statement:
2. Data Collection:
3. Data Cleaning:
As you have formulated your motive and also you did collect your data,
the next step to do is cleaning. Yes, it is! Data cleaning is the most
favourite thing for data scientists to do. Data cleaning is all about the
removal of missing, redundant, unnecessary and duplicate data from
your collection. There are various tools to do so with the help of
programming in either R or Python. It’s totally on you to choose one of
them. Various scientist has their opinion on which to choose. When it
comes to the statistical part, R is preferred over Python, as it has the
privilege of more than 12,000 packages. While python is used as it is
fast, easily accessible and we can perform the same things as we can in
R with the help of various packages.
7
It’s one of the prime things in data science to do and time to get inner
Holmes out. It’s about analysing the structure of data, finding hidden
patterns in them, studying behaviours, visualizing the effects of one
variable over others and then concluding. We can explore the data with
the help of various graphs formed with the help of libraries using any
programming language. In R, GGplot is one of the most famous models
while Matplotlib in Python.
5. Data Modelling:
Once you are done with your study that you have formed from data
visualization, you must start building a hypothesis model such that it
may yield you a good prediction in future. Here, you must choose a good
algorithm that best fit to your model. There different kinds of algorithms
from regression to classification, SVM (Support vector machines),
Clustering, etc. Your model can be of a Machine Learning algorithm.
You train your model with the train data and then test it with test data.
There are various methods to do so. One of them is the K-fold method
where you split your whole data into two parts, one is Train and the
other is test data. On these bases, you train your model.
You followed each and every step and hence build a model that you feel
is the best fit. But how can you decide how well your model is
performing? This where optimization comes. You test your data and find
how well it is performing by checking its accuracy. In short, you check
the efficiency of the data model and thus try to optimize it for better
accurate prediction. Deployment deals with the launch of your model
and let the people outside there to benefit from that. You can also obtain
feedback from organizations and people to know their need and then to
work more on your model.
Fig 2.3
8
CHAPTER : 3
Machine Learning concepts and Applications
Machine learning (ML) allows computers to learn and make decisions without
being explicitly programmed. It involves feeding data into algorithms to
identify patterns and make predictions on new data. Machine learning is used
in various applications, including image and speech recognition, natural
language processing, and recommender systems.
9
3.3 Importance of Data in Machine Learning:
Data is the foundation of machine learning (ML). Without quality data,
ML models cannot learn, perform, or make accurate predictions.
Fig 3.0
Fig 3.1
10
CHAPTER : 4
PYTHON
Python is a programming language widely used by Data Scientists.
Fig 4.1
Fig 4.2
11
4.3 Key Libraries and Tools:
NumPy: A fundamental library for numerical operations in Python,
supporting large, multi-dimensional arrays and matrices.
Fig 4.3
Fig 4.4
12
4.5 Applications of Python:
Fig 4.5
Benefits of Python:
Fig 4.6
Fig 4.7
13
CHAPTER: 5
Python Syntax, Data Types & Operators
Python is known for its clean and readable syntax, which makes it an
excellent language for beginners and professionals working in AI, data
science, and software development.
Comments start with # and are ignored by the interpreter. Use them to explain
your code.
Variables do not require a type declaration; the type is inferred from the value
(e.g., x = 10).
Functions are defined using the def keyword, and blocks of code are
structured using colons (:) followed by indented lines.
Control structures like if, elif, else, for, and while are written in a natural,
readable way.
Example:
# This is a comment
def greet(name):
if name:
else:
14
print ("Hello, Guest!")
greet("Alice")
Python also supports a REPL (Read-Eval-Print Loop) mode, where you can
type Python code line by line and see immediate results. This makes it great
for quick testing and learning. Overall, Python's syntax emphasizes
readability, simplicity, and consistency, which is why it's so widely loved by
beginners and professionals alike.
Fig 5.1
15
◆ 1. Numeric Types
These include:
◆ 2. Sequence Types
◆ 3. Set Types
◆ 4. Mapping Type
◆ 5. Boolean Type
◆ 6. Binary Types
16
◆ 7. None Type
Example:
a = 10 # int
b = 3.14 # float
c = "Python" # str
d = [1, 2, 3] # list
e = {"key": 1} # dict
f = True # bool
Python also allows you to check the type of a variable using the built-in type()
function, and you can convert between types using type casting, such as int(),
float(), str(), etc. Understanding data types is foundational for writing correct
Python code, as operations and functions behave differently depending on the
type of data they work with.
5.3 Operators:
In Python, operators are special symbols or keywords used to perform
operations on variables and values. Python supports several types of
operators that enable arithmetic operations, comparisons, logical decisions,
bitwise manipulations, and more. These operators make it easier to write
expressions that carry out calculations and control flow in programs.
1. Arithmetic Operators
Example:
a=5
b=2
print (a + b) # 7
print (a ** b) # 25
17
Used to compare values and return a boolean result:
>= (Greater than or equal to), <= (Less than or equal to)
Example:
x = 10
y = 20
3. Logical Operators
Example:
a=5
4. Assignment Operators
Example:
x=5
x += 3 # x becomes 8
5. Bitwise Operators
18
Example:
a=5 # 0101
b=3 # 0011
6. Membership Operators
Example:
7. Identity Operators
Example:
x = [1, 2, 3]
y=x
print (x is y) # True
◆ Conditional Statements
These statements let your program make decisions based on certain
conditions. Python uses:
19
if – executes a block if the condition is true
Example:
x = 10
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
◆ Looping Statements
Loops are used to repeat a block of code multiple times.
Examples:
# for loop
for i in range (5):
print(i)
# while loop
i=0
while i < 5:
print(i)
i += 1
20
pass – does nothing, used as a placeholder
Example:
Python offers many powerful string methods to work with text, such as:
21
strip () – removes whitespace from both ends
Example:
word = "Python"
Python also supports string formatting, which allows you to embed variables
into strings:
22
There are basically 3 types of operators supported by string:
Basic Operators: There are two types of basic operators in string. They are
“+” and “*”.
1. Concatenation Operator (+): the concatenation operator concatenates
two strings and forms a new string.
2. Replication Operator (*): It is used to repeat a string number of times
the string will be repeated the number of times is given by the integer
value.
Membership operators: To test whether a value is present in a sequence.
Relational Operators: All the comparisons operators i.e., (<,>, <=,>=, == ,!=,
<>)
Slice Notation: String Slice can be defined as substring which is the part of
string. Therefore, further substring can be obtained from a string.
Strings in Python are versatile and essential, used in everything from simple
output messages to file handling, data parsing, and user input. Their
flexibility and the wide range of methods make them one of the most
important data types in Python.
23
CHAPTER:6
Functions and Scope in Python
In Python: functions, modules, and exception handling. These concepts help
developers write organized, reusable, and error-free code, making Python a
powerful and efficient programming language for AI, data science, and
software development.
• Built-in Functions such as print (), len (), and range ().
keyword.
• Lambda Functions, which are small anonymous functions used for quick,
short operations.
Example:
def greet(name):
Python also supports default arguments, where parameters can have default
values:
24
python
Copy
Edit
def greet(name="Guest"):
Python also allows anonymous functions using the lambda keyword. These
are short, one-line functions used for simple tasks, especially with functions
like map (), filter (), and sorted ().
Example:
square = lambda x: x * x
Local scope:
Variables declared within a function have local scope. They are
accessible only within the function in which they are defined.
Local variables are created when the function is called and
destroyed when it exits.
Local variables cannot be accessed from outside the function.
25
Global Scope:
Variables declared outside of any function or at the top level of a
script have global scope. They are accessible throughout the
program.
During program startup, global variables are created in memory
and remain there until the program ends.
Global variables can be accessed from any function within the
program.
Nested scope:
Python allows nested functions, where one function is defined
inside another.
During nested functions, the inner function has access to
variables in the outer (enclosed) function.
The inner function's scope is called "nested scope" because it
includes both its local scope and the enclosing function's scope.
26
CHAPTER: 7
Packages and Modules in Python
Introduction
Python is a high-level, general-purpose programming language widely used in
various domains including data science, machine learning, web development,
and automation. One of Python’s key strengths is its modular structure,
which allows developers to organize code into reusable components. This
modularity is achieved through the use of modules and packages, which play
a vital role in organizing, maintaining, and scaling Python projects effectively.
Modules in Python
A module is a file containing Python code that is written for reuse. It typically
consists of functions, classes, and variables that serve specific functionalities.
The primary goal of a module is to break down large programs into smaller,
manageable, and logically organized parts. This enhances code readability,
promotes reuse, and simplifies debugging and maintenance.
Modules form the foundational building blocks of Python programs. They can
be standard (built-in to Python), third-party (installed externally), or user-
defined (created by the developer). Using modules also allows for separation
of concerns, where each module is responsible for a specific part of the
program logic, reducing complexity in large codebases.
27
Packages in Python
A package is a hierarchical file structure that contains multiple modules
grouped together to form a collection of related functionalities. Packages allow
developers to organize their modules into directories, thereby creating a
scalable project structure. The presence of a special initialization file in the
directory indicates to Python that it should treat the directory as a package.
Packages are essential when working on large projects that involve multiple
components. By categorizing similar modules into packages, developers can
avoid naming conflicts, improve code organization, and enable better
navigation through the codebase. Packages can also contain sub-packages,
allowing for multi-level structuring of code.
28
repetitive processes, and collaborate effectively in a team environment. This
approach not only improved the quality of the code but also enhanced overall
productivity.
Modules in Python are essential components that allow programmers to
organize code into separate files and reuse functionality across different
programs. A module is simply a file containing Python code—such as
functions, classes, or variables—that can be imported and used in another
Python script. Python supports various types of modules, including built-in
modules like math, os, and datetime, which come pre-installed and provide
powerful features for mathematical operations, file handling, and date/time
manipulation. Users can also create their own custom modules, known as
user-defined modules, to structure their code better and enhance reusability.
Additionally, third-party modules like numpy, pandas, matplotlib, and flask
can be installed using Python’s package manager pip to perform specific tasks
such as data analysis, visualization, and web development. Modules can be
imported using the import statement, and specific functions or classes can be
brought in using from module import name. By using modules, Python
promotes modular programming, which leads to cleaner, more manageable
code, encourages reusability, reduces redundancy, and improves overall
program structure. Whether for small scripts or large applications, modules
play a vital role in efficient and effective Python development.
29
CHAPTER: 8
EXCEPTION HANDLING IN PYTHON
Introduction
In any programming language, errors are a natural part of the development
process. Python provides a structured way to detect and handle these errors
using a mechanism called exception handling. This allows programs to
respond to unexpected situations without crashing, thereby improving
robustness, user experience, and overall software reliability.
Understanding Exceptions
An exception is an event that occurs during the execution of a program that
disrupts the normal flow of instructions. Exceptions are not necessarily errors
in logic; they often result from conditions that are beyond the control of the
program, such as attempting to access a file that does not exist or dividing a
number by zero.
In Python, exceptions are objects that represent these error conditions. When
an exception occurs, Python immediately stops the current flow of the
program and looks for a way to handle the exception. If not handled, the
program terminates and displays an error message, commonly referred to as
a traceback.
30
An optional block for cleanup actions.
This mechanism provides flexibility and control over how different types of
exceptions are managed and ensures that the program can continue running
or exit gracefully.
Error Isolation: Helps identify exactly where the error occurred without
affecting the rest of the code.
31
During my internship in the field of data science, I encountered several
scenarios where exception handling became necessary—for instance, when
handling missing values, managing file loading issues, or connecting to
external databases. Implementing structured exception handling helped me
build resilient scripts that could run reliably in different environments with
varying data inputs.
Conclusion
Exception handling is a fundamental aspect of writing robust and
professional-grade Python applications. It allows developers to anticipate and
manage errors effectively, ensuring that programs behave predictably even
under unexpected conditions. In data science and other real-world
applications, the ability to handle exceptions gracefully not only improves
performance but also enhances the reliability and trustworthiness of the
system. My internship experience underscored the importance of mastering
exception handling to create stable, scalable, and user-friendly Python
solutions.
32
CHAPTER: 9
PYTHON DATA STRCTURES
Introduction
Data structures are the foundational building blocks of any programming
language. In Python, data structures are used to store, organize, and manage
data efficiently. They provide a means of performing operations on data and
are essential for solving complex computational problems. Python offers a rich
collection of built-in data structures that are both flexible and easy to use,
which makes the language especially powerful for data science and software
development.
Integers
Floats
Strings
Booleans
While not considered data structures in the traditional sense, these primitives
form the basis for more complex types.
These include more advanced structures that are capable of storing multiple
elements and performing operations on them. The primary non-primitive data
structures in Python are:
33
Dictionaries: Key-value pairs for efficient lookup and storage.
Python’s built-in data structures are often used in combination with third-
party libraries like pandas, which extends their functionality for handling
structured data such as tables and time series.
Ease of Use: The syntax and operations associated with Python’s data
structures are intuitive and user-friendly.
34
Tasks such as data cleaning, transformation, and aggregation were greatly
facilitated by using dictionaries, lists, and sets. Understanding the underlying
structure of data allowed me to implement faster and more reliable solutions,
especially when dealing with large-scale operations or real-time data.
Data structures also supported integration with various tools and libraries,
enabling seamless development of end-to-end data workflows.
35
Chapter:10
Lists, Tuples, Sets, Dictionaries and Strings in
Python
List
A list in Python is a dynamic, ordered collection that can store elements of
different data types such as integers, floats, strings, or even other lists (nested
lists). Lists are mutable, so you can change, add, or delete elements without
creating a new list. They are defined using square brackets []. Lists are
versatile and widely used for storing a sequence of items such as a list of
student names, shopping items, or daily temperatures.
Example:
print(fruits)
String
A string is a sequence of Unicode characters used to represent text. Strings
are immutable, meaning once created, their content cannot be changed. You
can perform various operations on strings like slicing, searching, formatting,
and joining. Strings are defined using single ' or double " quotes, and multiline
strings use triple quotes ''' or """.
36
replace () – replaces part of the string
Example:
python
Tuple
A tuple is a collection similar to a list but immutable, meaning once it's
created, you cannot add, remove, or change elements. Tuples are defined
using parentheses (). Because they are immutable, they can be used as
dictionary keys or elements in a set, which lists cannot do. Tuples are
usually used when the data should not be changed throughout the program,
like coordinates (x, y) or months of the year.
Common operations:
Example:
python
Output = 20
Advantages:
Dictionary
A dictionary is an unordered, mutable collection of key-value pairs. Each
key must be unique and immutable (like strings, numbers, or tuples).
Dictionaries are written using curly braces {}. They are commonly used to
store data like student records, configurations, or any structured data.
37
Common methods:
Example:
python
print(student["name"])
Output = Alice
Use Cases:
Set
A set is a collection of unordered, unique items. Sets are useful when you
want to ensure there are no duplicate entries. Sets are mutable, meaning you
can add or remove elements, but they do not support indexing or slicing
because they are unordered. Sets are ideal for operations like union,
intersection, and difference between groups.
Common methods:
Example:
python
set1 = {1, 2, 3}
38
set2 = {3, 4, 5}
Output = {3}
39
Chapter: 11
Files and File Handling in Python
Files and File Handling in Python
In Python, file handling allows you to create, read, write, and delete files
directly from your Python program. This is especially useful when you want
to store data permanently, process text files, or interact with external files like
logs, reports, or configurations. Python provides built-in functions for file
handling, and the most common one is the open () function. This function is
used to open a file and returns a file object, which lets you perform various
operations on the file.
Add "b" for binary mode (e.g., "rb" for read binary)
To write to a file, use write () or writelines (). After you're done working with a
file, it’s important to close it using close () to free up system resources.
However, the better way to handle files in Python is using a with block (also
called a context manager), which automatically closes the file when done.
Example (writing and reading a file):
python
# Writing to a file
file.write("Python is fun!")
40
# Reading from a file
content = file.read()
print(content)
41
Chapter: 12
Regular Expressions in Python
Regular Expressions (commonly abbreviated as RegEx) are powerful tools
used in Python to search, match, and manipulate strings based on specific
patterns. They are especially useful when you need to validate input (like
emails or phone numbers), extract specific parts of text, or perform complex
text replacements. Python provides the re module for working with regular
expressions. To use it, you must import it with import re.
? – matches 0 or 1 repetition
Example:
python
import re
42
CERTIFICATE
EXTERNAL EXAMINER
iii
ACCEPTANCE LETTER FROM SKILLDZIRE
ORGANIZATION
iv
CERTIFICATE FROM INTERN ORGANIZATION
v
DECLARATION
Date: (21NT1A0458)
vi
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to all those who have
supported and guided me throughout my Python Course internship. My
heartfelt thanks to Skill Dzire Organization for providing me with the
opportunity to work and enhance my skills in the field of Python course. I am
deeply thankful to Visakha Institute of Engineering & Technology (VIET)
for offering a supportive environment that made this experience possible. I
extend my sincere appreciation to Dr. G. Satyanarayana, Chairman of VIET,
for his visionary leadership, and Dr. G.V. Pradeep Varma, Principal of VIET,
for his continuous encouragement. I would also like to thank Dr. D. Santha
Rao, Dean of Academics, for his insightful guidance, and Dr. P. Varma,
Training and Placement Officer (TPO), for his efforts in facilitating this
internship. My thanks are also due to Dr. B. Jeevana Rao, Head of the
Department of Electronics and Communication Engineering (ECE), for his
academic support. I am especially grateful to my Project Guide, Mrs. K.
KANTHI KINNERA M. tech, (Ph . D), for her valuable mentorship, constant
encouragement, and expert guidance throughout the internship. Additionally,
I would like to acknowledge the faculty members of the ECE department
whose teachings and support have played a crucial role in my academic
development.
vii
ABSTRACT
Data science encompasses a set of principles, problem definitions, algorithms,
and processes for extracting nonobvious and useful patterns from large data
sets. Many of the elements of data science have been developed in related
fields such as machine learning and data mining. In fact, the terms data
science, machine learning, and data mining are often used interchangeably.
The commonality across these disciplines is a focus on improving decision
making through the analysis of data. However, although data science borrows
from these other fields, it is broader in scope. Machine learning (ML) focuses
on the design and evaluation of algorithms for extracting patterns from data.
Data mining generally deals with the analysis of structured data and often
implies an emphasis on commercial applications. Data science takes all of
these considerations into account but also takes up other challenges, such as
the capturing, cleaning, and transforming of unstructured social media and
web data; the use of big-data technologies to store and process big,
unstructured data sets; and questions related to data ethics and regulation.
viii
CONTENTS
S.NO Name of the Topic/Chapter Page No. From
To
ix
Operators 17
Strings in Python 19
6 Functions and Scope in Python 24-26
Functions of Python 24
Scopes of python 25
7 Packages & Modules in Python 27-29
8 Exception Handling in Python 30-32
9 Python Data Structures Overview 33-35
10 Lists, Strings, Sets, Tuples, and Dictionaries in 36-39
Python
11 Files and File Handling in Python 40-41
12 Regular Expressions in Python 42-43
13 CONCLUSION 44
x
CHAPTER 1
INTRODUCTION TO AI
Fig1.0
Fig1.1
1
1.3 Types of Artificial Intelligence:
Artificial intelligence can be organized in several ways, depending on
stages of development or actions being performed.
Fig 1.2
2
1.4 Artificial Intelligence Training Models:
Supervised learning is a machine learning model that maps a specific
input to an output using labelled training data (structured data).
Fig 1.3
3
1.5 Benefits of AI:
Fig 1.4
1.6 Applications of AI:
Fig 1.5
4
CHAPTER : 2
What is Data Science
Data Science is a combination of multiple disciplines that uses statistics,
data analysis, and machine learning to analyse data and to extract
knowledge and insights from it.
Data Science is about finding patterns in data, through analysis, and make
future predictions.
Data Science can be applied in nearly every part of a business where data is
available. Examples are:
Consumer goods
Stock markets
Industry
Politics
Logistic companies
E-commerce
5
One purpose of Data Science is to structure data, making it
interpretable and easy to work with.
Structured data
Unstructured data
Fig 2.1
2.3 How Does a Data Scientist Work:
A Data Scientist requires expertise in several backgrounds:
Machine Learning
Statistics
Programming (Python or R)
Mathematics
Databases
6
Fig 2.2
1. Problem Statement:
2. Data Collection:
3. Data Cleaning:
As you have formulated your motive and also you did collect your data,
the next step to do is cleaning. Yes, it is! Data cleaning is the most
favourite thing for data scientists to do. Data cleaning is all about the
removal of missing, redundant, unnecessary and duplicate data from
your collection. There are various tools to do so with the help of
programming in either R or Python. It’s totally on you to choose one of
them. Various scientist has their opinion on which to choose. When it
comes to the statistical part, R is preferred over Python, as it has the
privilege of more than 12,000 packages. While python is used as it is
fast, easily accessible and we can perform the same things as we can in
R with the help of various packages.
7
It’s one of the prime things in data science to do and time to get inner
Holmes out. It’s about analysing the structure of data, finding hidden
patterns in them, studying behaviours, visualizing the effects of one
variable over others and then concluding. We can explore the data with
the help of various graphs formed with the help of libraries using any
programming language. In R, GGplot is one of the most famous models
while Matplotlib in Python.
5. Data Modelling:
Once you are done with your study that you have formed from data
visualization, you must start building a hypothesis model such that it
may yield you a good prediction in future. Here, you must choose a good
algorithm that best fit to your model. There different kinds of algorithms
from regression to classification, SVM (Support vector machines),
Clustering, etc. Your model can be of a Machine Learning algorithm.
You train your model with the train data and then test it with test data.
There are various methods to do so. One of them is the K-fold method
where you split your whole data into two parts, one is Train and the
other is test data. On these bases, you train your model.
You followed each and every step and hence build a model that you feel
is the best fit. But how can you decide how well your model is
performing? This where optimization comes. You test your data and find
how well it is performing by checking its accuracy. In short, you check
the efficiency of the data model and thus try to optimize it for better
accurate prediction. Deployment deals with the launch of your model
and let the people outside there to benefit from that. You can also obtain
feedback from organizations and people to know their need and then to
work more on your model.
Fig 2.3
8
CHAPTER : 3
Machine Learning concepts and Applications
Machine learning (ML) allows computers to learn and make decisions without
being explicitly programmed. It involves feeding data into algorithms to
identify patterns and make predictions on new data. Machine learning is used
in various applications, including image and speech recognition, natural
language processing, and recommender systems.
9
3.3 Importance of Data in Machine Learning:
Data is the foundation of machine learning (ML). Without quality data,
ML models cannot learn, perform, or make accurate predictions.
Fig 3.0
Fig 3.1
10
CHAPTER : 4
PYTHON
Python is a programming language widely used by Data Scientists.
Fig 4.1
Fig 4.2
11
4.3 Key Libraries and Tools:
NumPy: A fundamental library for numerical operations in Python,
supporting large, multi-dimensional arrays and matrices.
Fig 4.3
Fig 4.4
12
4.5 Applications of Python:
Fig 4.5
Benefits of Python:
Fig 4.6
Fig 4.7
13
CHAPTER: 5
Python Syntax, Data Types & Operators
Python is known for its clean and readable syntax, which makes it an
excellent language for beginners and professionals working in AI, data
science, and software development.
Comments start with # and are ignored by the interpreter. Use them to explain
your code.
Variables do not require a type declaration; the type is inferred from the value
(e.g., x = 10).
Functions are defined using the def keyword, and blocks of code are
structured using colons (:) followed by indented lines.
Control structures like if, elif, else, for, and while are written in a natural,
readable way.
Example:
# This is a comment
def greet(name):
if name:
else:
14
print ("Hello, Guest!")
greet("Alice")
Python also supports a REPL (Read-Eval-Print Loop) mode, where you can
type Python code line by line and see immediate results. This makes it great
for quick testing and learning. Overall, Python's syntax emphasizes
readability, simplicity, and consistency, which is why it's so widely loved by
beginners and professionals alike.
Fig 5.1
15
◆ 1. Numeric Types
These include:
◆ 2. Sequence Types
◆ 3. Set Types
◆ 4. Mapping Type
◆ 5. Boolean Type
◆ 6. Binary Types
16
◆ 7. None Type
Example:
a = 10 # int
b = 3.14 # float
c = "Python" # str
d = [1, 2, 3] # list
e = {"key": 1} # dict
f = True # bool
Python also allows you to check the type of a variable using the built-in type()
function, and you can convert between types using type casting, such as int(),
float(), str(), etc. Understanding data types is foundational for writing correct
Python code, as operations and functions behave differently depending on the
type of data they work with.
5.3 Operators:
In Python, operators are special symbols or keywords used to perform
operations on variables and values. Python supports several types of
operators that enable arithmetic operations, comparisons, logical decisions,
bitwise manipulations, and more. These operators make it easier to write
expressions that carry out calculations and control flow in programs.
1. Arithmetic Operators
Example:
a=5
b=2
print (a + b) # 7
print (a ** b) # 25
17
Used to compare values and return a boolean result:
>= (Greater than or equal to), <= (Less than or equal to)
Example:
x = 10
y = 20
3. Logical Operators
Example:
a=5
4. Assignment Operators
Example:
x=5
x += 3 # x becomes 8
5. Bitwise Operators
18
Example:
a=5 # 0101
b=3 # 0011
6. Membership Operators
Example:
7. Identity Operators
Example:
x = [1, 2, 3]
y=x
print (x is y) # True
◆ Conditional Statements
These statements let your program make decisions based on certain
conditions. Python uses:
19
if – executes a block if the condition is true
Example:
x = 10
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
◆ Looping Statements
Loops are used to repeat a block of code multiple times.
Examples:
# for loop
for i in range (5):
print(i)
# while loop
i=0
while i < 5:
print(i)
i += 1
20
pass – does nothing, used as a placeholder
Example:
Python offers many powerful string methods to work with text, such as:
21
strip () – removes whitespace from both ends
Example:
word = "Python"
Python also supports string formatting, which allows you to embed variables
into strings:
22
There are basically 3 types of operators supported by string:
Basic Operators: There are two types of basic operators in string. They are
“+” and “*”.
1. Concatenation Operator (+): the concatenation operator concatenates
two strings and forms a new string.
2. Replication Operator (*): It is used to repeat a string number of times
the string will be repeated the number of times is given by the integer
value.
Membership operators: To test whether a value is present in a sequence.
Relational Operators: All the comparisons operators i.e., (<,>, <=,>=, == ,!=,
<>)
Slice Notation: String Slice can be defined as substring which is the part of
string. Therefore, further substring can be obtained from a string.
Strings in Python are versatile and essential, used in everything from simple
output messages to file handling, data parsing, and user input. Their
flexibility and the wide range of methods make them one of the most
important data types in Python.
23
CHAPTER:6
Functions and Scope in Python
In Python: functions, modules, and exception handling. These concepts help
developers write organized, reusable, and error-free code, making Python a
powerful and efficient programming language for AI, data science, and
software development.
• Built-in Functions such as print (), len (), and range ().
keyword.
• Lambda Functions, which are small anonymous functions used for quick,
short operations.
Example:
def greet(name):
Python also supports default arguments, where parameters can have default
values:
24
python
Copy
Edit
def greet(name="Guest"):
Python also allows anonymous functions using the lambda keyword. These
are short, one-line functions used for simple tasks, especially with functions
like map (), filter (), and sorted ().
Example:
square = lambda x: x * x
Local scope:
Variables declared within a function have local scope. They are
accessible only within the function in which they are defined.
Local variables are created when the function is called and
destroyed when it exits.
Local variables cannot be accessed from outside the function.
25
Global Scope:
Variables declared outside of any function or at the top level of a
script have global scope. They are accessible throughout the
program.
During program startup, global variables are created in memory
and remain there until the program ends.
Global variables can be accessed from any function within the
program.
Nested scope:
Python allows nested functions, where one function is defined
inside another.
During nested functions, the inner function has access to
variables in the outer (enclosed) function.
The inner function's scope is called "nested scope" because it
includes both its local scope and the enclosing function's scope.
26
CHAPTER: 7
Packages and Modules in Python
Introduction
Python is a high-level, general-purpose programming language widely used in
various domains including data science, machine learning, web development,
and automation. One of Python’s key strengths is its modular structure,
which allows developers to organize code into reusable components. This
modularity is achieved through the use of modules and packages, which play
a vital role in organizing, maintaining, and scaling Python projects effectively.
Modules in Python
A module is a file containing Python code that is written for reuse. It typically
consists of functions, classes, and variables that serve specific functionalities.
The primary goal of a module is to break down large programs into smaller,
manageable, and logically organized parts. This enhances code readability,
promotes reuse, and simplifies debugging and maintenance.
Modules form the foundational building blocks of Python programs. They can
be standard (built-in to Python), third-party (installed externally), or user-
defined (created by the developer). Using modules also allows for separation
of concerns, where each module is responsible for a specific part of the
program logic, reducing complexity in large codebases.
27
Packages in Python
A package is a hierarchical file structure that contains multiple modules
grouped together to form a collection of related functionalities. Packages allow
developers to organize their modules into directories, thereby creating a
scalable project structure. The presence of a special initialization file in the
directory indicates to Python that it should treat the directory as a package.
Packages are essential when working on large projects that involve multiple
components. By categorizing similar modules into packages, developers can
avoid naming conflicts, improve code organization, and enable better
navigation through the codebase. Packages can also contain sub-packages,
allowing for multi-level structuring of code.
28
repetitive processes, and collaborate effectively in a team environment. This
approach not only improved the quality of the code but also enhanced overall
productivity.
Modules in Python are essential components that allow programmers to
organize code into separate files and reuse functionality across different
programs. A module is simply a file containing Python code—such as
functions, classes, or variables—that can be imported and used in another
Python script. Python supports various types of modules, including built-in
modules like math, os, and datetime, which come pre-installed and provide
powerful features for mathematical operations, file handling, and date/time
manipulation. Users can also create their own custom modules, known as
user-defined modules, to structure their code better and enhance reusability.
Additionally, third-party modules like numpy, pandas, matplotlib, and flask
can be installed using Python’s package manager pip to perform specific tasks
such as data analysis, visualization, and web development. Modules can be
imported using the import statement, and specific functions or classes can be
brought in using from module import name. By using modules, Python
promotes modular programming, which leads to cleaner, more manageable
code, encourages reusability, reduces redundancy, and improves overall
program structure. Whether for small scripts or large applications, modules
play a vital role in efficient and effective Python development.
29
CHAPTER: 8
EXCEPTION HANDLING IN PYTHON
Introduction
In any programming language, errors are a natural part of the development
process. Python provides a structured way to detect and handle these errors
using a mechanism called exception handling. This allows programs to
respond to unexpected situations without crashing, thereby improving
robustness, user experience, and overall software reliability.
Understanding Exceptions
An exception is an event that occurs during the execution of a program that
disrupts the normal flow of instructions. Exceptions are not necessarily errors
in logic; they often result from conditions that are beyond the control of the
program, such as attempting to access a file that does not exist or dividing a
number by zero.
In Python, exceptions are objects that represent these error conditions. When
an exception occurs, Python immediately stops the current flow of the
program and looks for a way to handle the exception. If not handled, the
program terminates and displays an error message, commonly referred to as
a traceback.
30
An optional block for cleanup actions.
This mechanism provides flexibility and control over how different types of
exceptions are managed and ensures that the program can continue running
or exit gracefully.
Error Isolation: Helps identify exactly where the error occurred without
affecting the rest of the code.
31
During my internship in the field of data science, I encountered several
scenarios where exception handling became necessary—for instance, when
handling missing values, managing file loading issues, or connecting to
external databases. Implementing structured exception handling helped me
build resilient scripts that could run reliably in different environments with
varying data inputs.
Conclusion
Exception handling is a fundamental aspect of writing robust and
professional-grade Python applications. It allows developers to anticipate and
manage errors effectively, ensuring that programs behave predictably even
under unexpected conditions. In data science and other real-world
applications, the ability to handle exceptions gracefully not only improves
performance but also enhances the reliability and trustworthiness of the
system. My internship experience underscored the importance of mastering
exception handling to create stable, scalable, and user-friendly Python
solutions.
32
CHAPTER: 9
PYTHON DATA STRCTURES
Introduction
Data structures are the foundational building blocks of any programming
language. In Python, data structures are used to store, organize, and manage
data efficiently. They provide a means of performing operations on data and
are essential for solving complex computational problems. Python offers a rich
collection of built-in data structures that are both flexible and easy to use,
which makes the language especially powerful for data science and software
development.
Integers
Floats
Strings
Booleans
While not considered data structures in the traditional sense, these primitives
form the basis for more complex types.
These include more advanced structures that are capable of storing multiple
elements and performing operations on them. The primary non-primitive data
structures in Python are:
33
Dictionaries: Key-value pairs for efficient lookup and storage.
Python’s built-in data structures are often used in combination with third-
party libraries like pandas, which extends their functionality for handling
structured data such as tables and time series.
Ease of Use: The syntax and operations associated with Python’s data
structures are intuitive and user-friendly.
34
Tasks such as data cleaning, transformation, and aggregation were greatly
facilitated by using dictionaries, lists, and sets. Understanding the underlying
structure of data allowed me to implement faster and more reliable solutions,
especially when dealing with large-scale operations or real-time data.
Data structures also supported integration with various tools and libraries,
enabling seamless development of end-to-end data workflows.
35
Chapter:10
Lists, Tuples, Sets, Dictionaries and Strings in
Python
List
A list in Python is a dynamic, ordered collection that can store elements of
different data types such as integers, floats, strings, or even other lists (nested
lists). Lists are mutable, so you can change, add, or delete elements without
creating a new list. They are defined using square brackets []. Lists are
versatile and widely used for storing a sequence of items such as a list of
student names, shopping items, or daily temperatures.
Example:
print(fruits)
String
A string is a sequence of Unicode characters used to represent text. Strings
are immutable, meaning once created, their content cannot be changed. You
can perform various operations on strings like slicing, searching, formatting,
and joining. Strings are defined using single ' or double " quotes, and multiline
strings use triple quotes ''' or """.
36
replace () – replaces part of the string
Example:
python
Tuple
A tuple is a collection similar to a list but immutable, meaning once it's
created, you cannot add, remove, or change elements. Tuples are defined
using parentheses (). Because they are immutable, they can be used as
dictionary keys or elements in a set, which lists cannot do. Tuples are
usually used when the data should not be changed throughout the program,
like coordinates (x, y) or months of the year.
Common operations:
Example:
python
Output = 20
Advantages:
Dictionary
A dictionary is an unordered, mutable collection of key-value pairs. Each
key must be unique and immutable (like strings, numbers, or tuples).
Dictionaries are written using curly braces {}. They are commonly used to
store data like student records, configurations, or any structured data.
37
Common methods:
Example:
python
print(student["name"])
Output = Alice
Use Cases:
Set
A set is a collection of unordered, unique items. Sets are useful when you
want to ensure there are no duplicate entries. Sets are mutable, meaning you
can add or remove elements, but they do not support indexing or slicing
because they are unordered. Sets are ideal for operations like union,
intersection, and difference between groups.
Common methods:
Example:
python
set1 = {1, 2, 3}
38
set2 = {3, 4, 5}
Output = {3}
39
Chapter: 11
Files and File Handling in Python
Files and File Handling in Python
In Python, file handling allows you to create, read, write, and delete files
directly from your Python program. This is especially useful when you want
to store data permanently, process text files, or interact with external files like
logs, reports, or configurations. Python provides built-in functions for file
handling, and the most common one is the open () function. This function is
used to open a file and returns a file object, which lets you perform various
operations on the file.
Add "b" for binary mode (e.g., "rb" for read binary)
To write to a file, use write () or writelines (). After you're done working with a
file, it’s important to close it using close () to free up system resources.
However, the better way to handle files in Python is using a with block (also
called a context manager), which automatically closes the file when done.
Example (writing and reading a file):
python
# Writing to a file
file.write("Python is fun!")
40
# Reading from a file
content = file.read()
print(content)
41
Chapter: 12
Regular Expressions in Python
Regular Expressions (commonly abbreviated as RegEx) are powerful tools
used in Python to search, match, and manipulate strings based on specific
patterns. They are especially useful when you need to validate input (like
emails or phone numbers), extract specific parts of text, or perform complex
text replacements. Python provides the re module for working with regular
expressions. To use it, you must import it with import re.
? – matches 0 or 1 repetition
Example:
python
import re
42
text = "My phone number is 9876543210"
if match:
Regular expressions can be tricky at first, but they are incredibly powerful
once mastered. You can build anything from simple string filters to complex
parsers. Python also allows the use of flags like re.IGNORECASE or
re.MULTILINE to control how matching is done.
43
ACCEPTANCE LETTER FROM SKILLDZIRE
ORGANIZATION
iv
CERTIFICATE FROM INTERN ORGANIZATION
v
DECLARATION
Date: (21NT1A0458)
vi
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to all those who have
supported and guided me throughout my Python Course internship. My
heartfelt thanks to Skill Dzire Organization for providing me with the
opportunity to work and enhance my skills in the field of Python course. I am
deeply thankful to Visakha Institute of Engineering & Technology (VIET)
for offering a supportive environment that made this experience possible. I
extend my sincere appreciation to Dr. G. Satyanarayana, Chairman of VIET,
for his visionary leadership, and Dr. G.V. Pradeep Varma, Principal of VIET,
for his continuous encouragement. I would also like to thank Dr. D. Santha
Rao, Dean of Academics, for his insightful guidance, and Dr. P. Varma,
Training and Placement Officer (TPO), for his efforts in facilitating this
internship. My thanks are also due to Dr. B. Jeevana Rao, Head of the
Department of Electronics and Communication Engineering (ECE), for his
academic support. I am especially grateful to my Project Guide, Mrs. K.
KANTHI KINNERA M. tech, (Ph . D), for her valuable mentorship, constant
encouragement, and expert guidance throughout the internship. Additionally,
I would like to acknowledge the faculty members of the ECE department
whose teachings and support have played a crucial role in my academic
development.
vii
ABSTRACT
Data science encompasses a set of principles, problem definitions, algorithms,
and processes for extracting nonobvious and useful patterns from large data
sets. Many of the elements of data science have been developed in related
fields such as machine learning and data mining. In fact, the terms data
science, machine learning, and data mining are often used interchangeably.
The commonality across these disciplines is a focus on improving decision
making through the analysis of data. However, although data science borrows
from these other fields, it is broader in scope. Machine learning (ML) focuses
on the design and evaluation of algorithms for extracting patterns from data.
Data mining generally deals with the analysis of structured data and often
implies an emphasis on commercial applications. Data science takes all of
these considerations into account but also takes up other challenges, such as
the capturing, cleaning, and transforming of unstructured social media and
web data; the use of big-data technologies to store and process big,
unstructured data sets; and questions related to data ethics and regulation.
viii
CONTENTS
S.NO Name of the Topic/Chapter Page No. From
To
ix
Operators 17
Strings in Python 19
6 Functions and Scope in Python 24-26
Functions of Python 24
Scopes of python 25
7 Packages & Modules in Python 27-29
8 Exception Handling in Python 30-32
9 Python Data Structures Overview 33-35
10 Lists, Strings, Sets, Tuples, and Dictionaries in 36-39
Python
11 Files and File Handling in Python 40-41
12 Regular Expressions in Python 42-43
13 CONCLUSION 44
x
CHAPTER 1
INTRODUCTION TO AI
Fig1.0
Fig1.1
1
1.3 Types of Artificial Intelligence:
Artificial intelligence can be organized in several ways, depending on
stages of development or actions being performed.
Fig 1.2
2
1.4 Artificial Intelligence Training Models:
Supervised learning is a machine learning model that maps a specific
input to an output using labelled training data (structured data).
Fig 1.3
3
1.5 Benefits of AI:
Fig 1.4
1.6 Applications of AI:
Fig 1.5
4
CHAPTER : 2
What is Data Science
Data Science is a combination of multiple disciplines that uses statistics,
data analysis, and machine learning to analyse data and to extract
knowledge and insights from it.
Data Science is about finding patterns in data, through analysis, and make
future predictions.
Data Science can be applied in nearly every part of a business where data is
available. Examples are:
Consumer goods
Stock markets
Industry
Politics
Logistic companies
E-commerce
5
One purpose of Data Science is to structure data, making it
interpretable and easy to work with.
Structured data
Unstructured data
Fig 2.1
2.3 How Does a Data Scientist Work:
A Data Scientist requires expertise in several backgrounds:
Machine Learning
Statistics
Programming (Python or R)
Mathematics
Databases
6
Fig 2.2
1. Problem Statement:
2. Data Collection:
3. Data Cleaning:
As you have formulated your motive and also you did collect your data,
the next step to do is cleaning. Yes, it is! Data cleaning is the most
favourite thing for data scientists to do. Data cleaning is all about the
removal of missing, redundant, unnecessary and duplicate data from
your collection. There are various tools to do so with the help of
programming in either R or Python. It’s totally on you to choose one of
them. Various scientist has their opinion on which to choose. When it
comes to the statistical part, R is preferred over Python, as it has the
privilege of more than 12,000 packages. While python is used as it is
fast, easily accessible and we can perform the same things as we can in
R with the help of various packages.
7
It’s one of the prime things in data science to do and time to get inner
Holmes out. It’s about analysing the structure of data, finding hidden
patterns in them, studying behaviours, visualizing the effects of one
variable over others and then concluding. We can explore the data with
the help of various graphs formed with the help of libraries using any
programming language. In R, GGplot is one of the most famous models
while Matplotlib in Python.
5. Data Modelling:
Once you are done with your study that you have formed from data
visualization, you must start building a hypothesis model such that it
may yield you a good prediction in future. Here, you must choose a good
algorithm that best fit to your model. There different kinds of algorithms
from regression to classification, SVM (Support vector machines),
Clustering, etc. Your model can be of a Machine Learning algorithm.
You train your model with the train data and then test it with test data.
There are various methods to do so. One of them is the K-fold method
where you split your whole data into two parts, one is Train and the
other is test data. On these bases, you train your model.
You followed each and every step and hence build a model that you feel
is the best fit. But how can you decide how well your model is
performing? This where optimization comes. You test your data and find
how well it is performing by checking its accuracy. In short, you check
the efficiency of the data model and thus try to optimize it for better
accurate prediction. Deployment deals with the launch of your model
and let the people outside there to benefit from that. You can also obtain
feedback from organizations and people to know their need and then to
work more on your model.
Fig 2.3
8
CHAPTER : 3
Machine Learning concepts and Applications
Machine learning (ML) allows computers to learn and make decisions without
being explicitly programmed. It involves feeding data into algorithms to
identify patterns and make predictions on new data. Machine learning is used
in various applications, including image and speech recognition, natural
language processing, and recommender systems.
9
3.3 Importance of Data in Machine Learning:
Data is the foundation of machine learning (ML). Without quality data,
ML models cannot learn, perform, or make accurate predictions.
Fig 3.0
Fig 3.1
10
CHAPTER : 4
PYTHON
Python is a programming language widely used by Data Scientists.
Fig 4.1
Fig 4.2
11
4.3 Key Libraries and Tools:
NumPy: A fundamental library for numerical operations in Python,
supporting large, multi-dimensional arrays and matrices.
Fig 4.3
Fig 4.4
12
4.5 Applications of Python:
Fig 4.5
Benefits of Python:
Fig 4.6
Fig 4.7
13
CHAPTER: 5
Python Syntax, Data Types & Operators
Python is known for its clean and readable syntax, which makes it an
excellent language for beginners and professionals working in AI, data
science, and software development.
Comments start with # and are ignored by the interpreter. Use them to explain
your code.
Variables do not require a type declaration; the type is inferred from the value
(e.g., x = 10).
Functions are defined using the def keyword, and blocks of code are
structured using colons (:) followed by indented lines.
Control structures like if, elif, else, for, and while are written in a natural,
readable way.
Example:
# This is a comment
def greet(name):
if name:
else:
14
print ("Hello, Guest!")
greet("Alice")
Python also supports a REPL (Read-Eval-Print Loop) mode, where you can
type Python code line by line and see immediate results. This makes it great
for quick testing and learning. Overall, Python's syntax emphasizes
readability, simplicity, and consistency, which is why it's so widely loved by
beginners and professionals alike.
Fig 5.1
15
◆ 1. Numeric Types
These include:
◆ 2. Sequence Types
◆ 3. Set Types
◆ 4. Mapping Type
◆ 5. Boolean Type
◆ 6. Binary Types
16
◆ 7. None Type
Example:
a = 10 # int
b = 3.14 # float
c = "Python" # str
d = [1, 2, 3] # list
e = {"key": 1} # dict
f = True # bool
Python also allows you to check the type of a variable using the built-in type()
function, and you can convert between types using type casting, such as int(),
float(), str(), etc. Understanding data types is foundational for writing correct
Python code, as operations and functions behave differently depending on the
type of data they work with.
5.3 Operators:
In Python, operators are special symbols or keywords used to perform
operations on variables and values. Python supports several types of
operators that enable arithmetic operations, comparisons, logical decisions,
bitwise manipulations, and more. These operators make it easier to write
expressions that carry out calculations and control flow in programs.
1. Arithmetic Operators
Example:
a=5
b=2
print (a + b) # 7
print (a ** b) # 25
17
Used to compare values and return a boolean result:
>= (Greater than or equal to), <= (Less than or equal to)
Example:
x = 10
y = 20
3. Logical Operators
Example:
a=5
4. Assignment Operators
Example:
x=5
x += 3 # x becomes 8
5. Bitwise Operators
18
Example:
a=5 # 0101
b=3 # 0011
6. Membership Operators
Example:
7. Identity Operators
Example:
x = [1, 2, 3]
y=x
print (x is y) # True
◆ Conditional Statements
These statements let your program make decisions based on certain
conditions. Python uses:
19
if – executes a block if the condition is true
Example:
x = 10
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
◆ Looping Statements
Loops are used to repeat a block of code multiple times.
Examples:
# for loop
for i in range (5):
print(i)
# while loop
i=0
while i < 5:
print(i)
i += 1
20
pass – does nothing, used as a placeholder
Example:
Python offers many powerful string methods to work with text, such as:
21
strip () – removes whitespace from both ends
Example:
word = "Python"
Python also supports string formatting, which allows you to embed variables
into strings:
22
There are basically 3 types of operators supported by string:
Basic Operators: There are two types of basic operators in string. They are
“+” and “*”.
1. Concatenation Operator (+): the concatenation operator concatenates
two strings and forms a new string.
2. Replication Operator (*): It is used to repeat a string number of times
the string will be repeated the number of times is given by the integer
value.
Membership operators: To test whether a value is present in a sequence.
Relational Operators: All the comparisons operators i.e., (<,>, <=,>=, == ,!=,
<>)
Slice Notation: String Slice can be defined as substring which is the part of
string. Therefore, further substring can be obtained from a string.
Strings in Python are versatile and essential, used in everything from simple
output messages to file handling, data parsing, and user input. Their
flexibility and the wide range of methods make them one of the most
important data types in Python.
23
CHAPTER:6
Functions and Scope in Python
In Python: functions, modules, and exception handling. These concepts help
developers write organized, reusable, and error-free code, making Python a
powerful and efficient programming language for AI, data science, and
software development.
• Built-in Functions such as print (), len (), and range ().
keyword.
• Lambda Functions, which are small anonymous functions used for quick,
short operations.
Example:
def greet(name):
Python also supports default arguments, where parameters can have default
values:
24
python
Copy
Edit
def greet(name="Guest"):
Python also allows anonymous functions using the lambda keyword. These
are short, one-line functions used for simple tasks, especially with functions
like map (), filter (), and sorted ().
Example:
square = lambda x: x * x
Local scope:
Variables declared within a function have local scope. They are
accessible only within the function in which they are defined.
Local variables are created when the function is called and
destroyed when it exits.
Local variables cannot be accessed from outside the function.
25
Global Scope:
Variables declared outside of any function or at the top level of a
script have global scope. They are accessible throughout the
program.
During program startup, global variables are created in memory
and remain there until the program ends.
Global variables can be accessed from any function within the
program.
Nested scope:
Python allows nested functions, where one function is defined
inside another.
During nested functions, the inner function has access to
variables in the outer (enclosed) function.
The inner function's scope is called "nested scope" because it
includes both its local scope and the enclosing function's scope.
26
CHAPTER: 7
Packages and Modules in Python
Introduction
Python is a high-level, general-purpose programming language widely used in
various domains including data science, machine learning, web development,
and automation. One of Python’s key strengths is its modular structure,
which allows developers to organize code into reusable components. This
modularity is achieved through the use of modules and packages, which play
a vital role in organizing, maintaining, and scaling Python projects effectively.
Modules in Python
A module is a file containing Python code that is written for reuse. It typically
consists of functions, classes, and variables that serve specific functionalities.
The primary goal of a module is to break down large programs into smaller,
manageable, and logically organized parts. This enhances code readability,
promotes reuse, and simplifies debugging and maintenance.
Modules form the foundational building blocks of Python programs. They can
be standard (built-in to Python), third-party (installed externally), or user-
defined (created by the developer). Using modules also allows for separation
of concerns, where each module is responsible for a specific part of the
program logic, reducing complexity in large codebases.
27
Packages in Python
A package is a hierarchical file structure that contains multiple modules
grouped together to form a collection of related functionalities. Packages allow
developers to organize their modules into directories, thereby creating a
scalable project structure. The presence of a special initialization file in the
directory indicates to Python that it should treat the directory as a package.
Packages are essential when working on large projects that involve multiple
components. By categorizing similar modules into packages, developers can
avoid naming conflicts, improve code organization, and enable better
navigation through the codebase. Packages can also contain sub-packages,
allowing for multi-level structuring of code.
28
repetitive processes, and collaborate effectively in a team environment. This
approach not only improved the quality of the code but also enhanced overall
productivity.
Modules in Python are essential components that allow programmers to
organize code into separate files and reuse functionality across different
programs. A module is simply a file containing Python code—such as
functions, classes, or variables—that can be imported and used in another
Python script. Python supports various types of modules, including built-in
modules like math, os, and datetime, which come pre-installed and provide
powerful features for mathematical operations, file handling, and date/time
manipulation. Users can also create their own custom modules, known as
user-defined modules, to structure their code better and enhance reusability.
Additionally, third-party modules like numpy, pandas, matplotlib, and flask
can be installed using Python’s package manager pip to perform specific tasks
such as data analysis, visualization, and web development. Modules can be
imported using the import statement, and specific functions or classes can be
brought in using from module import name. By using modules, Python
promotes modular programming, which leads to cleaner, more manageable
code, encourages reusability, reduces redundancy, and improves overall
program structure. Whether for small scripts or large applications, modules
play a vital role in efficient and effective Python development.
29
CHAPTER: 8
EXCEPTION HANDLING IN PYTHON
Introduction
In any programming language, errors are a natural part of the development
process. Python provides a structured way to detect and handle these errors
using a mechanism called exception handling. This allows programs to
respond to unexpected situations without crashing, thereby improving
robustness, user experience, and overall software reliability.
Understanding Exceptions
An exception is an event that occurs during the execution of a program that
disrupts the normal flow of instructions. Exceptions are not necessarily errors
in logic; they often result from conditions that are beyond the control of the
program, such as attempting to access a file that does not exist or dividing a
number by zero.
In Python, exceptions are objects that represent these error conditions. When
an exception occurs, Python immediately stops the current flow of the
program and looks for a way to handle the exception. If not handled, the
program terminates and displays an error message, commonly referred to as
a traceback.
30
An optional block for cleanup actions.
This mechanism provides flexibility and control over how different types of
exceptions are managed and ensures that the program can continue running
or exit gracefully.
Error Isolation: Helps identify exactly where the error occurred without
affecting the rest of the code.
31
During my internship in the field of data science, I encountered several
scenarios where exception handling became necessary—for instance, when
handling missing values, managing file loading issues, or connecting to
external databases. Implementing structured exception handling helped me
build resilient scripts that could run reliably in different environments with
varying data inputs.
Conclusion
Exception handling is a fundamental aspect of writing robust and
professional-grade Python applications. It allows developers to anticipate and
manage errors effectively, ensuring that programs behave predictably even
under unexpected conditions. In data science and other real-world
applications, the ability to handle exceptions gracefully not only improves
performance but also enhances the reliability and trustworthiness of the
system. My internship experience underscored the importance of mastering
exception handling to create stable, scalable, and user-friendly Python
solutions.
32
CHAPTER: 9
PYTHON DATA STRCTURES
Introduction
Data structures are the foundational building blocks of any programming
language. In Python, data structures are used to store, organize, and manage
data efficiently. They provide a means of performing operations on data and
are essential for solving complex computational problems. Python offers a rich
collection of built-in data structures that are both flexible and easy to use,
which makes the language especially powerful for data science and software
development.
Integers
Floats
Strings
Booleans
While not considered data structures in the traditional sense, these primitives
form the basis for more complex types.
These include more advanced structures that are capable of storing multiple
elements and performing operations on them. The primary non-primitive data
structures in Python are:
33
Dictionaries: Key-value pairs for efficient lookup and storage.
Python’s built-in data structures are often used in combination with third-
party libraries like pandas, which extends their functionality for handling
structured data such as tables and time series.
Ease of Use: The syntax and operations associated with Python’s data
structures are intuitive and user-friendly.
34
Tasks such as data cleaning, transformation, and aggregation were greatly
facilitated by using dictionaries, lists, and sets. Understanding the underlying
structure of data allowed me to implement faster and more reliable solutions,
especially when dealing with large-scale operations or real-time data.
Data structures also supported integration with various tools and libraries,
enabling seamless development of end-to-end data workflows.
35
Chapter:10
Lists, Tuples, Sets, Dictionaries and Strings in
Python
List
A list in Python is a dynamic, ordered collection that can store elements of
different data types such as integers, floats, strings, or even other lists (nested
lists). Lists are mutable, so you can change, add, or delete elements without
creating a new list. They are defined using square brackets []. Lists are
versatile and widely used for storing a sequence of items such as a list of
student names, shopping items, or daily temperatures.
Example:
print(fruits)
String
A string is a sequence of Unicode characters used to represent text. Strings
are immutable, meaning once created, their content cannot be changed. You
can perform various operations on strings like slicing, searching, formatting,
and joining. Strings are defined using single ' or double " quotes, and multiline
strings use triple quotes ''' or """.
36
replace () – replaces part of the string
Example:
python
Tuple
A tuple is a collection similar to a list but immutable, meaning once it's
created, you cannot add, remove, or change elements. Tuples are defined
using parentheses (). Because they are immutable, they can be used as
dictionary keys or elements in a set, which lists cannot do. Tuples are
usually used when the data should not be changed throughout the program,
like coordinates (x, y) or months of the year.
Common operations:
Example:
python
Output = 20
Advantages:
Dictionary
A dictionary is an unordered, mutable collection of key-value pairs. Each
key must be unique and immutable (like strings, numbers, or tuples).
Dictionaries are written using curly braces {}. They are commonly used to
store data like student records, configurations, or any structured data.
37
Common methods:
Example:
python
print(student["name"])
Output = Alice
Use Cases:
Set
A set is a collection of unordered, unique items. Sets are useful when you
want to ensure there are no duplicate entries. Sets are mutable, meaning you
can add or remove elements, but they do not support indexing or slicing
because they are unordered. Sets are ideal for operations like union,
intersection, and difference between groups.
Common methods:
Example:
python
set1 = {1, 2, 3}
38
set2 = {3, 4, 5}
Output = {3}
39
Chapter: 11
Files and File Handling in Python
Files and File Handling in Python
In Python, file handling allows you to create, read, write, and delete files
directly from your Python program. This is especially useful when you want
to store data permanently, process text files, or interact with external files like
logs, reports, or configurations. Python provides built-in functions for file
handling, and the most common one is the open () function. This function is
used to open a file and returns a file object, which lets you perform various
operations on the file.
Add "b" for binary mode (e.g., "rb" for read binary)
To write to a file, use write () or writelines (). After you're done working with a
file, it’s important to close it using close () to free up system resources.
However, the better way to handle files in Python is using a with block (also
called a context manager), which automatically closes the file when done.
Example (writing and reading a file):
python
# Writing to a file
file.write("Python is fun!")
40
# Reading from a file
content = file.read()
print(content)
41
Chapter: 12
Regular Expressions in Python
Regular Expressions (commonly abbreviated as RegEx) are powerful tools
used in Python to search, match, and manipulate strings based on specific
patterns. They are especially useful when you need to validate input (like
emails or phone numbers), extract specific parts of text, or perform complex
text replacements. Python provides the re module for working with regular
expressions. To use it, you must import it with import re.
? – matches 0 or 1 repetition
Example:
python
import re
42
text = "My phone number is 9876543210"
if match:
Regular expressions can be tricky at first, but they are incredibly powerful
once mastered. You can build anything from simple string filters to complex
parsers. Python also allows the use of flags like re.IGNORECASE or
re.MULTILINE to control how matching is done.
43
CHAPTER : 13
CONCLUSION
Data Science stands at the forefront of the digital revolution, playing a pivotal
role in transforming raw data into meaningful insights that drive strategic
decisions. It is a multidisciplinary field that blends mathematics, statistics,
programming, and domain knowledge to solve real-world problems. From
healthcare and finance to agriculture and entertainment, data science is being
used to optimize operations, predict future trends, personalize user
experiences, and automate tasks through artificial intelligence and machine
learning.
44
CERTIFICATE FROM INTERN ORGANIZATION
v
DECLARATION
Date: (21NT1A0458)
vi
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to all those who have
supported and guided me throughout my Python Course internship. My
heartfelt thanks to Skill Dzire Organization for providing me with the
opportunity to work and enhance my skills in the field of Python course. I am
deeply thankful to Visakha Institute of Engineering & Technology (VIET)
for offering a supportive environment that made this experience possible. I
extend my sincere appreciation to Dr. G. Satyanarayana, Chairman of VIET,
for his visionary leadership, and Dr. G.V. Pradeep Varma, Principal of VIET,
for his continuous encouragement. I would also like to thank Dr. D. Santha
Rao, Dean of Academics, for his insightful guidance, and Dr. P. Varma,
Training and Placement Officer (TPO), for his efforts in facilitating this
internship. My thanks are also due to Dr. B. Jeevana Rao, Head of the
Department of Electronics and Communication Engineering (ECE), for his
academic support. I am especially grateful to my Project Guide, Mrs. K.
KANTHI KINNERA M. tech, (Ph . D), for her valuable mentorship, constant
encouragement, and expert guidance throughout the internship. Additionally,
I would like to acknowledge the faculty members of the ECE department
whose teachings and support have played a crucial role in my academic
development.
vii
ABSTRACT
Data science encompasses a set of principles, problem definitions, algorithms,
and processes for extracting nonobvious and useful patterns from large data
sets. Many of the elements of data science have been developed in related
fields such as machine learning and data mining. In fact, the terms data
science, machine learning, and data mining are often used interchangeably.
The commonality across these disciplines is a focus on improving decision
making through the analysis of data. However, although data science borrows
from these other fields, it is broader in scope. Machine learning (ML) focuses
on the design and evaluation of algorithms for extracting patterns from data.
Data mining generally deals with the analysis of structured data and often
implies an emphasis on commercial applications. Data science takes all of
these considerations into account but also takes up other challenges, such as
the capturing, cleaning, and transforming of unstructured social media and
web data; the use of big-data technologies to store and process big,
unstructured data sets; and questions related to data ethics and regulation.
viii
CONTENTS
S.NO Name of the Topic/Chapter Page No. From
To
ix
Operators 17
Strings in Python 19
6 Functions and Scope in Python 24-26
Functions of Python 24
Scopes of python 25
7 Packages & Modules in Python 27-29
8 Exception Handling in Python 30-32
9 Python Data Structures Overview 33-35
10 Lists, Strings, Sets, Tuples, and Dictionaries in 36-39
Python
11 Files and File Handling in Python 40-41
12 Regular Expressions in Python 42-43
13 CONCLUSION 44
x
CHAPTER 1
INTRODUCTION TO AI
Fig1.0
Fig1.1
1
1.3 Types of Artificial Intelligence:
Artificial intelligence can be organized in several ways, depending on
stages of development or actions being performed.
Fig 1.2
2
1.4 Artificial Intelligence Training Models:
Supervised learning is a machine learning model that maps a specific
input to an output using labelled training data (structured data).
Fig 1.3
3
1.5 Benefits of AI:
Fig 1.4
1.6 Applications of AI:
Fig 1.5
4
CHAPTER : 2
What is Data Science
Data Science is a combination of multiple disciplines that uses statistics,
data analysis, and machine learning to analyse data and to extract
knowledge and insights from it.
Data Science is about finding patterns in data, through analysis, and make
future predictions.
Data Science can be applied in nearly every part of a business where data is
available. Examples are:
Consumer goods
Stock markets
Industry
Politics
Logistic companies
E-commerce
5
One purpose of Data Science is to structure data, making it
interpretable and easy to work with.
Structured data
Unstructured data
Fig 2.1
2.3 How Does a Data Scientist Work:
A Data Scientist requires expertise in several backgrounds:
Machine Learning
Statistics
Programming (Python or R)
Mathematics
Databases
6
Fig 2.2
1. Problem Statement:
2. Data Collection:
3. Data Cleaning:
As you have formulated your motive and also you did collect your data,
the next step to do is cleaning. Yes, it is! Data cleaning is the most
favourite thing for data scientists to do. Data cleaning is all about the
removal of missing, redundant, unnecessary and duplicate data from
your collection. There are various tools to do so with the help of
programming in either R or Python. It’s totally on you to choose one of
them. Various scientist has their opinion on which to choose. When it
comes to the statistical part, R is preferred over Python, as it has the
privilege of more than 12,000 packages. While python is used as it is
fast, easily accessible and we can perform the same things as we can in
R with the help of various packages.
7
It’s one of the prime things in data science to do and time to get inner
Holmes out. It’s about analysing the structure of data, finding hidden
patterns in them, studying behaviours, visualizing the effects of one
variable over others and then concluding. We can explore the data with
the help of various graphs formed with the help of libraries using any
programming language. In R, GGplot is one of the most famous models
while Matplotlib in Python.
5. Data Modelling:
Once you are done with your study that you have formed from data
visualization, you must start building a hypothesis model such that it
may yield you a good prediction in future. Here, you must choose a good
algorithm that best fit to your model. There different kinds of algorithms
from regression to classification, SVM (Support vector machines),
Clustering, etc. Your model can be of a Machine Learning algorithm.
You train your model with the train data and then test it with test data.
There are various methods to do so. One of them is the K-fold method
where you split your whole data into two parts, one is Train and the
other is test data. On these bases, you train your model.
You followed each and every step and hence build a model that you feel
is the best fit. But how can you decide how well your model is
performing? This where optimization comes. You test your data and find
how well it is performing by checking its accuracy. In short, you check
the efficiency of the data model and thus try to optimize it for better
accurate prediction. Deployment deals with the launch of your model
and let the people outside there to benefit from that. You can also obtain
feedback from organizations and people to know their need and then to
work more on your model.
Fig 2.3
8
CHAPTER : 3
Machine Learning concepts and Applications
Machine learning (ML) allows computers to learn and make decisions without
being explicitly programmed. It involves feeding data into algorithms to
identify patterns and make predictions on new data. Machine learning is used
in various applications, including image and speech recognition, natural
language processing, and recommender systems.
9
3.3 Importance of Data in Machine Learning:
Data is the foundation of machine learning (ML). Without quality data,
ML models cannot learn, perform, or make accurate predictions.
Fig 3.0
Fig 3.1
10
CHAPTER : 4
PYTHON
Python is a programming language widely used by Data Scientists.
Fig 4.1
Fig 4.2
11
4.3 Key Libraries and Tools:
NumPy: A fundamental library for numerical operations in Python,
supporting large, multi-dimensional arrays and matrices.
Fig 4.3
Fig 4.4
12
4.5 Applications of Python:
Fig 4.5
Benefits of Python:
Fig 4.6
Fig 4.7
13
CHAPTER: 5
Python Syntax, Data Types & Operators
Python is known for its clean and readable syntax, which makes it an
excellent language for beginners and professionals working in AI, data
science, and software development.
Comments start with # and are ignored by the interpreter. Use them to explain
your code.
Variables do not require a type declaration; the type is inferred from the value
(e.g., x = 10).
Functions are defined using the def keyword, and blocks of code are
structured using colons (:) followed by indented lines.
Control structures like if, elif, else, for, and while are written in a natural,
readable way.
Example:
# This is a comment
def greet(name):
if name:
else:
14
print ("Hello, Guest!")
greet("Alice")
Python also supports a REPL (Read-Eval-Print Loop) mode, where you can
type Python code line by line and see immediate results. This makes it great
for quick testing and learning. Overall, Python's syntax emphasizes
readability, simplicity, and consistency, which is why it's so widely loved by
beginners and professionals alike.
Fig 5.1
15
◆ 1. Numeric Types
These include:
◆ 2. Sequence Types
◆ 3. Set Types
◆ 4. Mapping Type
◆ 5. Boolean Type
◆ 6. Binary Types
16
◆ 7. None Type
Example:
a = 10 # int
b = 3.14 # float
c = "Python" # str
d = [1, 2, 3] # list
e = {"key": 1} # dict
f = True # bool
Python also allows you to check the type of a variable using the built-in type()
function, and you can convert between types using type casting, such as int(),
float(), str(), etc. Understanding data types is foundational for writing correct
Python code, as operations and functions behave differently depending on the
type of data they work with.
5.3 Operators:
In Python, operators are special symbols or keywords used to perform
operations on variables and values. Python supports several types of
operators that enable arithmetic operations, comparisons, logical decisions,
bitwise manipulations, and more. These operators make it easier to write
expressions that carry out calculations and control flow in programs.
1. Arithmetic Operators
Example:
a=5
b=2
print (a + b) # 7
print (a ** b) # 25
17
Used to compare values and return a boolean result:
>= (Greater than or equal to), <= (Less than or equal to)
Example:
x = 10
y = 20
3. Logical Operators
Example:
a=5
4. Assignment Operators
Example:
x=5
x += 3 # x becomes 8
5. Bitwise Operators
18
Example:
a=5 # 0101
b=3 # 0011
6. Membership Operators
Example:
7. Identity Operators
Example:
x = [1, 2, 3]
y=x
print (x is y) # True
◆ Conditional Statements
These statements let your program make decisions based on certain
conditions. Python uses:
19
if – executes a block if the condition is true
Example:
x = 10
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
◆ Looping Statements
Loops are used to repeat a block of code multiple times.
Examples:
# for loop
for i in range (5):
print(i)
# while loop
i=0
while i < 5:
print(i)
i += 1
20
pass – does nothing, used as a placeholder
Example:
Python offers many powerful string methods to work with text, such as:
21
strip () – removes whitespace from both ends
Example:
word = "Python"
Python also supports string formatting, which allows you to embed variables
into strings:
22
There are basically 3 types of operators supported by string:
Basic Operators: There are two types of basic operators in string. They are
“+” and “*”.
1. Concatenation Operator (+): the concatenation operator concatenates
two strings and forms a new string.
2. Replication Operator (*): It is used to repeat a string number of times
the string will be repeated the number of times is given by the integer
value.
Membership operators: To test whether a value is present in a sequence.
Relational Operators: All the comparisons operators i.e., (<,>, <=,>=, == ,!=,
<>)
Slice Notation: String Slice can be defined as substring which is the part of
string. Therefore, further substring can be obtained from a string.
Strings in Python are versatile and essential, used in everything from simple
output messages to file handling, data parsing, and user input. Their
flexibility and the wide range of methods make them one of the most
important data types in Python.
23
CHAPTER:6
Functions and Scope in Python
In Python: functions, modules, and exception handling. These concepts help
developers write organized, reusable, and error-free code, making Python a
powerful and efficient programming language for AI, data science, and
software development.
• Built-in Functions such as print (), len (), and range ().
keyword.
• Lambda Functions, which are small anonymous functions used for quick,
short operations.
Example:
def greet(name):
Python also supports default arguments, where parameters can have default
values:
24
python
Copy
Edit
def greet(name="Guest"):
Python also allows anonymous functions using the lambda keyword. These
are short, one-line functions used for simple tasks, especially with functions
like map (), filter (), and sorted ().
Example:
square = lambda x: x * x
Local scope:
Variables declared within a function have local scope. They are
accessible only within the function in which they are defined.
Local variables are created when the function is called and
destroyed when it exits.
Local variables cannot be accessed from outside the function.
25
Global Scope:
Variables declared outside of any function or at the top level of a
script have global scope. They are accessible throughout the
program.
During program startup, global variables are created in memory
and remain there until the program ends.
Global variables can be accessed from any function within the
program.
Nested scope:
Python allows nested functions, where one function is defined
inside another.
During nested functions, the inner function has access to
variables in the outer (enclosed) function.
The inner function's scope is called "nested scope" because it
includes both its local scope and the enclosing function's scope.
26
CHAPTER: 7
Packages and Modules in Python
Introduction
Python is a high-level, general-purpose programming language widely used in
various domains including data science, machine learning, web development,
and automation. One of Python’s key strengths is its modular structure,
which allows developers to organize code into reusable components. This
modularity is achieved through the use of modules and packages, which play
a vital role in organizing, maintaining, and scaling Python projects effectively.
Modules in Python
A module is a file containing Python code that is written for reuse. It typically
consists of functions, classes, and variables that serve specific functionalities.
The primary goal of a module is to break down large programs into smaller,
manageable, and logically organized parts. This enhances code readability,
promotes reuse, and simplifies debugging and maintenance.
Modules form the foundational building blocks of Python programs. They can
be standard (built-in to Python), third-party (installed externally), or user-
defined (created by the developer). Using modules also allows for separation
of concerns, where each module is responsible for a specific part of the
program logic, reducing complexity in large codebases.
27
Packages in Python
A package is a hierarchical file structure that contains multiple modules
grouped together to form a collection of related functionalities. Packages allow
developers to organize their modules into directories, thereby creating a
scalable project structure. The presence of a special initialization file in the
directory indicates to Python that it should treat the directory as a package.
Packages are essential when working on large projects that involve multiple
components. By categorizing similar modules into packages, developers can
avoid naming conflicts, improve code organization, and enable better
navigation through the codebase. Packages can also contain sub-packages,
allowing for multi-level structuring of code.
28
repetitive processes, and collaborate effectively in a team environment. This
approach not only improved the quality of the code but also enhanced overall
productivity.
Modules in Python are essential components that allow programmers to
organize code into separate files and reuse functionality across different
programs. A module is simply a file containing Python code—such as
functions, classes, or variables—that can be imported and used in another
Python script. Python supports various types of modules, including built-in
modules like math, os, and datetime, which come pre-installed and provide
powerful features for mathematical operations, file handling, and date/time
manipulation. Users can also create their own custom modules, known as
user-defined modules, to structure their code better and enhance reusability.
Additionally, third-party modules like numpy, pandas, matplotlib, and flask
can be installed using Python’s package manager pip to perform specific tasks
such as data analysis, visualization, and web development. Modules can be
imported using the import statement, and specific functions or classes can be
brought in using from module import name. By using modules, Python
promotes modular programming, which leads to cleaner, more manageable
code, encourages reusability, reduces redundancy, and improves overall
program structure. Whether for small scripts or large applications, modules
play a vital role in efficient and effective Python development.
29
CHAPTER: 8
EXCEPTION HANDLING IN PYTHON
Introduction
In any programming language, errors are a natural part of the development
process. Python provides a structured way to detect and handle these errors
using a mechanism called exception handling. This allows programs to
respond to unexpected situations without crashing, thereby improving
robustness, user experience, and overall software reliability.
Understanding Exceptions
An exception is an event that occurs during the execution of a program that
disrupts the normal flow of instructions. Exceptions are not necessarily errors
in logic; they often result from conditions that are beyond the control of the
program, such as attempting to access a file that does not exist or dividing a
number by zero.
In Python, exceptions are objects that represent these error conditions. When
an exception occurs, Python immediately stops the current flow of the
program and looks for a way to handle the exception. If not handled, the
program terminates and displays an error message, commonly referred to as
a traceback.
30
An optional block for cleanup actions.
This mechanism provides flexibility and control over how different types of
exceptions are managed and ensures that the program can continue running
or exit gracefully.
Error Isolation: Helps identify exactly where the error occurred without
affecting the rest of the code.
31
During my internship in the field of data science, I encountered several
scenarios where exception handling became necessary—for instance, when
handling missing values, managing file loading issues, or connecting to
external databases. Implementing structured exception handling helped me
build resilient scripts that could run reliably in different environments with
varying data inputs.
Conclusion
Exception handling is a fundamental aspect of writing robust and
professional-grade Python applications. It allows developers to anticipate and
manage errors effectively, ensuring that programs behave predictably even
under unexpected conditions. In data science and other real-world
applications, the ability to handle exceptions gracefully not only improves
performance but also enhances the reliability and trustworthiness of the
system. My internship experience underscored the importance of mastering
exception handling to create stable, scalable, and user-friendly Python
solutions.
32
CHAPTER: 9
PYTHON DATA STRCTURES
Introduction
Data structures are the foundational building blocks of any programming
language. In Python, data structures are used to store, organize, and manage
data efficiently. They provide a means of performing operations on data and
are essential for solving complex computational problems. Python offers a rich
collection of built-in data structures that are both flexible and easy to use,
which makes the language especially powerful for data science and software
development.
Integers
Floats
Strings
Booleans
While not considered data structures in the traditional sense, these primitives
form the basis for more complex types.
These include more advanced structures that are capable of storing multiple
elements and performing operations on them. The primary non-primitive data
structures in Python are:
33
Dictionaries: Key-value pairs for efficient lookup and storage.
Python’s built-in data structures are often used in combination with third-
party libraries like pandas, which extends their functionality for handling
structured data such as tables and time series.
Ease of Use: The syntax and operations associated with Python’s data
structures are intuitive and user-friendly.
34
Tasks such as data cleaning, transformation, and aggregation were greatly
facilitated by using dictionaries, lists, and sets. Understanding the underlying
structure of data allowed me to implement faster and more reliable solutions,
especially when dealing with large-scale operations or real-time data.
Data structures also supported integration with various tools and libraries,
enabling seamless development of end-to-end data workflows.
35
Chapter:10
Lists, Tuples, Sets, Dictionaries and Strings in
Python
List
A list in Python is a dynamic, ordered collection that can store elements of
different data types such as integers, floats, strings, or even other lists (nested
lists). Lists are mutable, so you can change, add, or delete elements without
creating a new list. They are defined using square brackets []. Lists are
versatile and widely used for storing a sequence of items such as a list of
student names, shopping items, or daily temperatures.
Example:
print(fruits)
String
A string is a sequence of Unicode characters used to represent text. Strings
are immutable, meaning once created, their content cannot be changed. You
can perform various operations on strings like slicing, searching, formatting,
and joining. Strings are defined using single ' or double " quotes, and multiline
strings use triple quotes ''' or """.
36
replace () – replaces part of the string
Example:
python
Tuple
A tuple is a collection similar to a list but immutable, meaning once it's
created, you cannot add, remove, or change elements. Tuples are defined
using parentheses (). Because they are immutable, they can be used as
dictionary keys or elements in a set, which lists cannot do. Tuples are
usually used when the data should not be changed throughout the program,
like coordinates (x, y) or months of the year.
Common operations:
Example:
python
Output = 20
Advantages:
Dictionary
A dictionary is an unordered, mutable collection of key-value pairs. Each
key must be unique and immutable (like strings, numbers, or tuples).
Dictionaries are written using curly braces {}. They are commonly used to
store data like student records, configurations, or any structured data.
37
Common methods:
Example:
python
print(student["name"])
Output = Alice
Use Cases:
Set
A set is a collection of unordered, unique items. Sets are useful when you
want to ensure there are no duplicate entries. Sets are mutable, meaning you
can add or remove elements, but they do not support indexing or slicing
because they are unordered. Sets are ideal for operations like union,
intersection, and difference between groups.
Common methods:
Example:
python
set1 = {1, 2, 3}
38
set2 = {3, 4, 5}
Output = {3}
39
Chapter: 11
Files and File Handling in Python
Files and File Handling in Python
In Python, file handling allows you to create, read, write, and delete files
directly from your Python program. This is especially useful when you want
to store data permanently, process text files, or interact with external files like
logs, reports, or configurations. Python provides built-in functions for file
handling, and the most common one is the open () function. This function is
used to open a file and returns a file object, which lets you perform various
operations on the file.
Add "b" for binary mode (e.g., "rb" for read binary)
To write to a file, use write () or writelines (). After you're done working with a
file, it’s important to close it using close () to free up system resources.
However, the better way to handle files in Python is using a with block (also
called a context manager), which automatically closes the file when done.
Example (writing and reading a file):
python
# Writing to a file
file.write("Python is fun!")
40
# Reading from a file
content = file.read()
print(content)
41
Chapter: 12
Regular Expressions in Python
Regular Expressions (commonly abbreviated as RegEx) are powerful tools
used in Python to search, match, and manipulate strings based on specific
patterns. They are especially useful when you need to validate input (like
emails or phone numbers), extract specific parts of text, or perform complex
text replacements. Python provides the re module for working with regular
expressions. To use it, you must import it with import re.
? – matches 0 or 1 repetition
Example:
python
import re
42
text = "My phone number is 9876543210"
if match:
Regular expressions can be tricky at first, but they are incredibly powerful
once mastered. You can build anything from simple string filters to complex
parsers. Python also allows the use of flags like re.IGNORECASE or
re.MULTILINE to control how matching is done.
43
CHAPTER : 13
CONCLUSION
Data Science stands at the forefront of the digital revolution, playing a pivotal
role in transforming raw data into meaningful insights that drive strategic
decisions. It is a multidisciplinary field that blends mathematics, statistics,
programming, and domain knowledge to solve real-world problems. From
healthcare and finance to agriculture and entertainment, data science is being
used to optimize operations, predict future trends, personalize user
experiences, and automate tasks through artificial intelligence and machine
learning.
44
DECLARATION
Date: (21NT1A0458)
vi
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to all those who have
supported and guided me throughout my Python Course internship. My
heartfelt thanks to Skill Dzire Organization for providing me with the
opportunity to work and enhance my skills in the field of Python course. I am
deeply thankful to Visakha Institute of Engineering & Technology (VIET)
for offering a supportive environment that made this experience possible. I
extend my sincere appreciation to Dr. G. Satyanarayana, Chairman of VIET,
for his visionary leadership, and Dr. G.V. Pradeep Varma, Principal of VIET,
for his continuous encouragement. I would also like to thank Dr. D. Santha
Rao, Dean of Academics, for his insightful guidance, and Dr. P. Varma,
Training and Placement Officer (TPO), for his efforts in facilitating this
internship. My thanks are also due to Dr. B. Jeevana Rao, Head of the
Department of Electronics and Communication Engineering (ECE), for his
academic support. I am especially grateful to my Project Guide, Mrs. K.
KANTHI KINNERA M. tech, (Ph . D), for her valuable mentorship, constant
encouragement, and expert guidance throughout the internship. Additionally,
I would like to acknowledge the faculty members of the ECE department
whose teachings and support have played a crucial role in my academic
development.
vii
ABSTRACT
Data science encompasses a set of principles, problem definitions, algorithms,
and processes for extracting nonobvious and useful patterns from large data
sets. Many of the elements of data science have been developed in related
fields such as machine learning and data mining. In fact, the terms data
science, machine learning, and data mining are often used interchangeably.
The commonality across these disciplines is a focus on improving decision
making through the analysis of data. However, although data science borrows
from these other fields, it is broader in scope. Machine learning (ML) focuses
on the design and evaluation of algorithms for extracting patterns from data.
Data mining generally deals with the analysis of structured data and often
implies an emphasis on commercial applications. Data science takes all of
these considerations into account but also takes up other challenges, such as
the capturing, cleaning, and transforming of unstructured social media and
web data; the use of big-data technologies to store and process big,
unstructured data sets; and questions related to data ethics and regulation.
viii
CONTENTS
S.NO Name of the Topic/Chapter Page No. From
To
ix
Operators 17
Strings in Python 19
6 Functions and Scope in Python 24-26
Functions of Python 24
Scopes of python 25
7 Packages & Modules in Python 27-29
8 Exception Handling in Python 30-32
9 Python Data Structures Overview 33-35
10 Lists, Strings, Sets, Tuples, and Dictionaries in 36-39
Python
11 Files and File Handling in Python 40-41
12 Regular Expressions in Python 42-43
13 CONCLUSION 44
x
CHAPTER 1
INTRODUCTION TO AI
Fig1.0
Fig1.1
1
1.3 Types of Artificial Intelligence:
Artificial intelligence can be organized in several ways, depending on
stages of development or actions being performed.
Fig 1.2
2
1.4 Artificial Intelligence Training Models:
Supervised learning is a machine learning model that maps a specific
input to an output using labelled training data (structured data).
Fig 1.3
3
1.5 Benefits of AI:
Fig 1.4
1.6 Applications of AI:
Fig 1.5
4
CHAPTER : 2
What is Data Science
Data Science is a combination of multiple disciplines that uses statistics,
data analysis, and machine learning to analyse data and to extract
knowledge and insights from it.
Data Science is about finding patterns in data, through analysis, and make
future predictions.
Data Science can be applied in nearly every part of a business where data is
available. Examples are:
Consumer goods
Stock markets
Industry
Politics
Logistic companies
E-commerce
5
One purpose of Data Science is to structure data, making it
interpretable and easy to work with.
Structured data
Unstructured data
Fig 2.1
2.3 How Does a Data Scientist Work:
A Data Scientist requires expertise in several backgrounds:
Machine Learning
Statistics
Programming (Python or R)
Mathematics
Databases
6
Fig 2.2
1. Problem Statement:
2. Data Collection:
3. Data Cleaning:
As you have formulated your motive and also you did collect your data,
the next step to do is cleaning. Yes, it is! Data cleaning is the most
favourite thing for data scientists to do. Data cleaning is all about the
removal of missing, redundant, unnecessary and duplicate data from
your collection. There are various tools to do so with the help of
programming in either R or Python. It’s totally on you to choose one of
them. Various scientist has their opinion on which to choose. When it
comes to the statistical part, R is preferred over Python, as it has the
privilege of more than 12,000 packages. While python is used as it is
fast, easily accessible and we can perform the same things as we can in
R with the help of various packages.
7
It’s one of the prime things in data science to do and time to get inner
Holmes out. It’s about analysing the structure of data, finding hidden
patterns in them, studying behaviours, visualizing the effects of one
variable over others and then concluding. We can explore the data with
the help of various graphs formed with the help of libraries using any
programming language. In R, GGplot is one of the most famous models
while Matplotlib in Python.
5. Data Modelling:
Once you are done with your study that you have formed from data
visualization, you must start building a hypothesis model such that it
may yield you a good prediction in future. Here, you must choose a good
algorithm that best fit to your model. There different kinds of algorithms
from regression to classification, SVM (Support vector machines),
Clustering, etc. Your model can be of a Machine Learning algorithm.
You train your model with the train data and then test it with test data.
There are various methods to do so. One of them is the K-fold method
where you split your whole data into two parts, one is Train and the
other is test data. On these bases, you train your model.
You followed each and every step and hence build a model that you feel
is the best fit. But how can you decide how well your model is
performing? This where optimization comes. You test your data and find
how well it is performing by checking its accuracy. In short, you check
the efficiency of the data model and thus try to optimize it for better
accurate prediction. Deployment deals with the launch of your model
and let the people outside there to benefit from that. You can also obtain
feedback from organizations and people to know their need and then to
work more on your model.
Fig 2.3
8
CHAPTER : 3
Machine Learning concepts and Applications
Machine learning (ML) allows computers to learn and make decisions without
being explicitly programmed. It involves feeding data into algorithms to
identify patterns and make predictions on new data. Machine learning is used
in various applications, including image and speech recognition, natural
language processing, and recommender systems.
9
3.3 Importance of Data in Machine Learning:
Data is the foundation of machine learning (ML). Without quality data,
ML models cannot learn, perform, or make accurate predictions.
Fig 3.0
Fig 3.1
10
CHAPTER : 4
PYTHON
Python is a programming language widely used by Data Scientists.
Fig 4.1
Fig 4.2
11
4.3 Key Libraries and Tools:
NumPy: A fundamental library for numerical operations in Python,
supporting large, multi-dimensional arrays and matrices.
Fig 4.3
Fig 4.4
12
4.5 Applications of Python:
Fig 4.5
Benefits of Python:
Fig 4.6
Fig 4.7
13
CHAPTER: 5
Python Syntax, Data Types & Operators
Python is known for its clean and readable syntax, which makes it an
excellent language for beginners and professionals working in AI, data
science, and software development.
Comments start with # and are ignored by the interpreter. Use them to explain
your code.
Variables do not require a type declaration; the type is inferred from the value
(e.g., x = 10).
Functions are defined using the def keyword, and blocks of code are
structured using colons (:) followed by indented lines.
Control structures like if, elif, else, for, and while are written in a natural,
readable way.
Example:
# This is a comment
def greet(name):
if name:
else:
14
print ("Hello, Guest!")
greet("Alice")
Python also supports a REPL (Read-Eval-Print Loop) mode, where you can
type Python code line by line and see immediate results. This makes it great
for quick testing and learning. Overall, Python's syntax emphasizes
readability, simplicity, and consistency, which is why it's so widely loved by
beginners and professionals alike.
Fig 5.1
15
◆ 1. Numeric Types
These include:
◆ 2. Sequence Types
◆ 3. Set Types
◆ 4. Mapping Type
◆ 5. Boolean Type
◆ 6. Binary Types
16
◆ 7. None Type
Example:
a = 10 # int
b = 3.14 # float
c = "Python" # str
d = [1, 2, 3] # list
e = {"key": 1} # dict
f = True # bool
Python also allows you to check the type of a variable using the built-in type()
function, and you can convert between types using type casting, such as int(),
float(), str(), etc. Understanding data types is foundational for writing correct
Python code, as operations and functions behave differently depending on the
type of data they work with.
5.3 Operators:
In Python, operators are special symbols or keywords used to perform
operations on variables and values. Python supports several types of
operators that enable arithmetic operations, comparisons, logical decisions,
bitwise manipulations, and more. These operators make it easier to write
expressions that carry out calculations and control flow in programs.
1. Arithmetic Operators
Example:
a=5
b=2
print (a + b) # 7
print (a ** b) # 25
17
Used to compare values and return a boolean result:
>= (Greater than or equal to), <= (Less than or equal to)
Example:
x = 10
y = 20
3. Logical Operators
Example:
a=5
4. Assignment Operators
Example:
x=5
x += 3 # x becomes 8
5. Bitwise Operators
18
Example:
a=5 # 0101
b=3 # 0011
6. Membership Operators
Example:
7. Identity Operators
Example:
x = [1, 2, 3]
y=x
print (x is y) # True
◆ Conditional Statements
These statements let your program make decisions based on certain
conditions. Python uses:
19
if – executes a block if the condition is true
Example:
x = 10
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
◆ Looping Statements
Loops are used to repeat a block of code multiple times.
Examples:
# for loop
for i in range (5):
print(i)
# while loop
i=0
while i < 5:
print(i)
i += 1
20
pass – does nothing, used as a placeholder
Example:
Python offers many powerful string methods to work with text, such as:
21
strip () – removes whitespace from both ends
Example:
word = "Python"
Python also supports string formatting, which allows you to embed variables
into strings:
22
There are basically 3 types of operators supported by string:
Basic Operators: There are two types of basic operators in string. They are
“+” and “*”.
1. Concatenation Operator (+): the concatenation operator concatenates
two strings and forms a new string.
2. Replication Operator (*): It is used to repeat a string number of times
the string will be repeated the number of times is given by the integer
value.
Membership operators: To test whether a value is present in a sequence.
Relational Operators: All the comparisons operators i.e., (<,>, <=,>=, == ,!=,
<>)
Slice Notation: String Slice can be defined as substring which is the part of
string. Therefore, further substring can be obtained from a string.
Strings in Python are versatile and essential, used in everything from simple
output messages to file handling, data parsing, and user input. Their
flexibility and the wide range of methods make them one of the most
important data types in Python.
23
CHAPTER:6
Functions and Scope in Python
In Python: functions, modules, and exception handling. These concepts help
developers write organized, reusable, and error-free code, making Python a
powerful and efficient programming language for AI, data science, and
software development.
• Built-in Functions such as print (), len (), and range ().
keyword.
• Lambda Functions, which are small anonymous functions used for quick,
short operations.
Example:
def greet(name):
Python also supports default arguments, where parameters can have default
values:
24
python
Copy
Edit
def greet(name="Guest"):
Python also allows anonymous functions using the lambda keyword. These
are short, one-line functions used for simple tasks, especially with functions
like map (), filter (), and sorted ().
Example:
square = lambda x: x * x
Local scope:
Variables declared within a function have local scope. They are
accessible only within the function in which they are defined.
Local variables are created when the function is called and
destroyed when it exits.
Local variables cannot be accessed from outside the function.
25
Global Scope:
Variables declared outside of any function or at the top level of a
script have global scope. They are accessible throughout the
program.
During program startup, global variables are created in memory
and remain there until the program ends.
Global variables can be accessed from any function within the
program.
Nested scope:
Python allows nested functions, where one function is defined
inside another.
During nested functions, the inner function has access to
variables in the outer (enclosed) function.
The inner function's scope is called "nested scope" because it
includes both its local scope and the enclosing function's scope.
26
CHAPTER: 7
Packages and Modules in Python
Introduction
Python is a high-level, general-purpose programming language widely used in
various domains including data science, machine learning, web development,
and automation. One of Python’s key strengths is its modular structure,
which allows developers to organize code into reusable components. This
modularity is achieved through the use of modules and packages, which play
a vital role in organizing, maintaining, and scaling Python projects effectively.
Modules in Python
A module is a file containing Python code that is written for reuse. It typically
consists of functions, classes, and variables that serve specific functionalities.
The primary goal of a module is to break down large programs into smaller,
manageable, and logically organized parts. This enhances code readability,
promotes reuse, and simplifies debugging and maintenance.
Modules form the foundational building blocks of Python programs. They can
be standard (built-in to Python), third-party (installed externally), or user-
defined (created by the developer). Using modules also allows for separation
of concerns, where each module is responsible for a specific part of the
program logic, reducing complexity in large codebases.
27
Packages in Python
A package is a hierarchical file structure that contains multiple modules
grouped together to form a collection of related functionalities. Packages allow
developers to organize their modules into directories, thereby creating a
scalable project structure. The presence of a special initialization file in the
directory indicates to Python that it should treat the directory as a package.
Packages are essential when working on large projects that involve multiple
components. By categorizing similar modules into packages, developers can
avoid naming conflicts, improve code organization, and enable better
navigation through the codebase. Packages can also contain sub-packages,
allowing for multi-level structuring of code.
28
repetitive processes, and collaborate effectively in a team environment. This
approach not only improved the quality of the code but also enhanced overall
productivity.
Modules in Python are essential components that allow programmers to
organize code into separate files and reuse functionality across different
programs. A module is simply a file containing Python code—such as
functions, classes, or variables—that can be imported and used in another
Python script. Python supports various types of modules, including built-in
modules like math, os, and datetime, which come pre-installed and provide
powerful features for mathematical operations, file handling, and date/time
manipulation. Users can also create their own custom modules, known as
user-defined modules, to structure their code better and enhance reusability.
Additionally, third-party modules like numpy, pandas, matplotlib, and flask
can be installed using Python’s package manager pip to perform specific tasks
such as data analysis, visualization, and web development. Modules can be
imported using the import statement, and specific functions or classes can be
brought in using from module import name. By using modules, Python
promotes modular programming, which leads to cleaner, more manageable
code, encourages reusability, reduces redundancy, and improves overall
program structure. Whether for small scripts or large applications, modules
play a vital role in efficient and effective Python development.
29
CHAPTER: 8
EXCEPTION HANDLING IN PYTHON
Introduction
In any programming language, errors are a natural part of the development
process. Python provides a structured way to detect and handle these errors
using a mechanism called exception handling. This allows programs to
respond to unexpected situations without crashing, thereby improving
robustness, user experience, and overall software reliability.
Understanding Exceptions
An exception is an event that occurs during the execution of a program that
disrupts the normal flow of instructions. Exceptions are not necessarily errors
in logic; they often result from conditions that are beyond the control of the
program, such as attempting to access a file that does not exist or dividing a
number by zero.
In Python, exceptions are objects that represent these error conditions. When
an exception occurs, Python immediately stops the current flow of the
program and looks for a way to handle the exception. If not handled, the
program terminates and displays an error message, commonly referred to as
a traceback.
30
An optional block for cleanup actions.
This mechanism provides flexibility and control over how different types of
exceptions are managed and ensures that the program can continue running
or exit gracefully.
Error Isolation: Helps identify exactly where the error occurred without
affecting the rest of the code.
31
During my internship in the field of data science, I encountered several
scenarios where exception handling became necessary—for instance, when
handling missing values, managing file loading issues, or connecting to
external databases. Implementing structured exception handling helped me
build resilient scripts that could run reliably in different environments with
varying data inputs.
Conclusion
Exception handling is a fundamental aspect of writing robust and
professional-grade Python applications. It allows developers to anticipate and
manage errors effectively, ensuring that programs behave predictably even
under unexpected conditions. In data science and other real-world
applications, the ability to handle exceptions gracefully not only improves
performance but also enhances the reliability and trustworthiness of the
system. My internship experience underscored the importance of mastering
exception handling to create stable, scalable, and user-friendly Python
solutions.
32
CHAPTER: 9
PYTHON DATA STRCTURES
Introduction
Data structures are the foundational building blocks of any programming
language. In Python, data structures are used to store, organize, and manage
data efficiently. They provide a means of performing operations on data and
are essential for solving complex computational problems. Python offers a rich
collection of built-in data structures that are both flexible and easy to use,
which makes the language especially powerful for data science and software
development.
Integers
Floats
Strings
Booleans
While not considered data structures in the traditional sense, these primitives
form the basis for more complex types.
These include more advanced structures that are capable of storing multiple
elements and performing operations on them. The primary non-primitive data
structures in Python are:
33
Dictionaries: Key-value pairs for efficient lookup and storage.
Python’s built-in data structures are often used in combination with third-
party libraries like pandas, which extends their functionality for handling
structured data such as tables and time series.
Ease of Use: The syntax and operations associated with Python’s data
structures are intuitive and user-friendly.
34
Tasks such as data cleaning, transformation, and aggregation were greatly
facilitated by using dictionaries, lists, and sets. Understanding the underlying
structure of data allowed me to implement faster and more reliable solutions,
especially when dealing with large-scale operations or real-time data.
Data structures also supported integration with various tools and libraries,
enabling seamless development of end-to-end data workflows.
35
Chapter:10
Lists, Tuples, Sets, Dictionaries and Strings in
Python
List
A list in Python is a dynamic, ordered collection that can store elements of
different data types such as integers, floats, strings, or even other lists (nested
lists). Lists are mutable, so you can change, add, or delete elements without
creating a new list. They are defined using square brackets []. Lists are
versatile and widely used for storing a sequence of items such as a list of
student names, shopping items, or daily temperatures.
Example:
print(fruits)
String
A string is a sequence of Unicode characters used to represent text. Strings
are immutable, meaning once created, their content cannot be changed. You
can perform various operations on strings like slicing, searching, formatting,
and joining. Strings are defined using single ' or double " quotes, and multiline
strings use triple quotes ''' or """.
36
replace () – replaces part of the string
Example:
python
Tuple
A tuple is a collection similar to a list but immutable, meaning once it's
created, you cannot add, remove, or change elements. Tuples are defined
using parentheses (). Because they are immutable, they can be used as
dictionary keys or elements in a set, which lists cannot do. Tuples are
usually used when the data should not be changed throughout the program,
like coordinates (x, y) or months of the year.
Common operations:
Example:
python
Output = 20
Advantages:
Dictionary
A dictionary is an unordered, mutable collection of key-value pairs. Each
key must be unique and immutable (like strings, numbers, or tuples).
Dictionaries are written using curly braces {}. They are commonly used to
store data like student records, configurations, or any structured data.
37
Common methods:
Example:
python
print(student["name"])
Output = Alice
Use Cases:
Set
A set is a collection of unordered, unique items. Sets are useful when you
want to ensure there are no duplicate entries. Sets are mutable, meaning you
can add or remove elements, but they do not support indexing or slicing
because they are unordered. Sets are ideal for operations like union,
intersection, and difference between groups.
Common methods:
Example:
python
set1 = {1, 2, 3}
38
set2 = {3, 4, 5}
Output = {3}
39
Chapter: 11
Files and File Handling in Python
Files and File Handling in Python
In Python, file handling allows you to create, read, write, and delete files
directly from your Python program. This is especially useful when you want
to store data permanently, process text files, or interact with external files like
logs, reports, or configurations. Python provides built-in functions for file
handling, and the most common one is the open () function. This function is
used to open a file and returns a file object, which lets you perform various
operations on the file.
Add "b" for binary mode (e.g., "rb" for read binary)
To write to a file, use write () or writelines (). After you're done working with a
file, it’s important to close it using close () to free up system resources.
However, the better way to handle files in Python is using a with block (also
called a context manager), which automatically closes the file when done.
Example (writing and reading a file):
python
# Writing to a file
file.write("Python is fun!")
40
# Reading from a file
content = file.read()
print(content)
41
Chapter: 12
Regular Expressions in Python
Regular Expressions (commonly abbreviated as RegEx) are powerful tools
used in Python to search, match, and manipulate strings based on specific
patterns. They are especially useful when you need to validate input (like
emails or phone numbers), extract specific parts of text, or perform complex
text replacements. Python provides the re module for working with regular
expressions. To use it, you must import it with import re.
? – matches 0 or 1 repetition
Example:
python
import re
42
text = "My phone number is 9876543210"
if match:
Regular expressions can be tricky at first, but they are incredibly powerful
once mastered. You can build anything from simple string filters to complex
parsers. Python also allows the use of flags like re.IGNORECASE or
re.MULTILINE to control how matching is done.
43
CHAPTER : 13
CONCLUSION
Data Science stands at the forefront of the digital revolution, playing a pivotal
role in transforming raw data into meaningful insights that drive strategic
decisions. It is a multidisciplinary field that blends mathematics, statistics,
programming, and domain knowledge to solve real-world problems. From
healthcare and finance to agriculture and entertainment, data science is being
used to optimize operations, predict future trends, personalize user
experiences, and automate tasks through artificial intelligence and machine
learning.
44
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to all those who have
supported and guided me throughout my Python Course internship. My
heartfelt thanks to Skill Dzire Organization for providing me with the
opportunity to work and enhance my skills in the field of Python course. I am
deeply thankful to Visakha Institute of Engineering & Technology (VIET)
for offering a supportive environment that made this experience possible. I
extend my sincere appreciation to Dr. G. Satyanarayana, Chairman of VIET,
for his visionary leadership, and Dr. G.V. Pradeep Varma, Principal of VIET,
for his continuous encouragement. I would also like to thank Dr. D. Santha
Rao, Dean of Academics, for his insightful guidance, and Dr. P. Varma,
Training and Placement Officer (TPO), for his efforts in facilitating this
internship. My thanks are also due to Dr. B. Jeevana Rao, Head of the
Department of Electronics and Communication Engineering (ECE), for his
academic support. I am especially grateful to my Project Guide, Mrs. K.
KANTHI KINNERA M. tech, (Ph . D), for her valuable mentorship, constant
encouragement, and expert guidance throughout the internship. Additionally,
I would like to acknowledge the faculty members of the ECE department
whose teachings and support have played a crucial role in my academic
development.
vii
ABSTRACT
Data science encompasses a set of principles, problem definitions, algorithms,
and processes for extracting nonobvious and useful patterns from large data
sets. Many of the elements of data science have been developed in related
fields such as machine learning and data mining. In fact, the terms data
science, machine learning, and data mining are often used interchangeably.
The commonality across these disciplines is a focus on improving decision
making through the analysis of data. However, although data science borrows
from these other fields, it is broader in scope. Machine learning (ML) focuses
on the design and evaluation of algorithms for extracting patterns from data.
Data mining generally deals with the analysis of structured data and often
implies an emphasis on commercial applications. Data science takes all of
these considerations into account but also takes up other challenges, such as
the capturing, cleaning, and transforming of unstructured social media and
web data; the use of big-data technologies to store and process big,
unstructured data sets; and questions related to data ethics and regulation.
viii
CONTENTS
S.NO Name of the Topic/Chapter Page No. From
To
ix
Operators 17
Strings in Python 19
6 Functions and Scope in Python 24-26
Functions of Python 24
Scopes of python 25
7 Packages & Modules in Python 27-29
8 Exception Handling in Python 30-32
9 Python Data Structures Overview 33-35
10 Lists, Strings, Sets, Tuples, and Dictionaries in 36-39
Python
11 Files and File Handling in Python 40-41
12 Regular Expressions in Python 42-43
13 CONCLUSION 44
x
CHAPTER 1
INTRODUCTION TO AI
Fig1.0
Fig1.1
1
1.3 Types of Artificial Intelligence:
Artificial intelligence can be organized in several ways, depending on
stages of development or actions being performed.
Fig 1.2
2
1.4 Artificial Intelligence Training Models:
Supervised learning is a machine learning model that maps a specific
input to an output using labelled training data (structured data).
Fig 1.3
3
1.5 Benefits of AI:
Fig 1.4
1.6 Applications of AI:
Fig 1.5
4
CHAPTER : 2
What is Data Science
Data Science is a combination of multiple disciplines that uses statistics,
data analysis, and machine learning to analyse data and to extract
knowledge and insights from it.
Data Science is about finding patterns in data, through analysis, and make
future predictions.
Data Science can be applied in nearly every part of a business where data is
available. Examples are:
Consumer goods
Stock markets
Industry
Politics
Logistic companies
E-commerce
5
One purpose of Data Science is to structure data, making it
interpretable and easy to work with.
Structured data
Unstructured data
Fig 2.1
2.3 How Does a Data Scientist Work:
A Data Scientist requires expertise in several backgrounds:
Machine Learning
Statistics
Programming (Python or R)
Mathematics
Databases
6
Fig 2.2
1. Problem Statement:
2. Data Collection:
3. Data Cleaning:
As you have formulated your motive and also you did collect your data,
the next step to do is cleaning. Yes, it is! Data cleaning is the most
favourite thing for data scientists to do. Data cleaning is all about the
removal of missing, redundant, unnecessary and duplicate data from
your collection. There are various tools to do so with the help of
programming in either R or Python. It’s totally on you to choose one of
them. Various scientist has their opinion on which to choose. When it
comes to the statistical part, R is preferred over Python, as it has the
privilege of more than 12,000 packages. While python is used as it is
fast, easily accessible and we can perform the same things as we can in
R with the help of various packages.
7
It’s one of the prime things in data science to do and time to get inner
Holmes out. It’s about analysing the structure of data, finding hidden
patterns in them, studying behaviours, visualizing the effects of one
variable over others and then concluding. We can explore the data with
the help of various graphs formed with the help of libraries using any
programming language. In R, GGplot is one of the most famous models
while Matplotlib in Python.
5. Data Modelling:
Once you are done with your study that you have formed from data
visualization, you must start building a hypothesis model such that it
may yield you a good prediction in future. Here, you must choose a good
algorithm that best fit to your model. There different kinds of algorithms
from regression to classification, SVM (Support vector machines),
Clustering, etc. Your model can be of a Machine Learning algorithm.
You train your model with the train data and then test it with test data.
There are various methods to do so. One of them is the K-fold method
where you split your whole data into two parts, one is Train and the
other is test data. On these bases, you train your model.
You followed each and every step and hence build a model that you feel
is the best fit. But how can you decide how well your model is
performing? This where optimization comes. You test your data and find
how well it is performing by checking its accuracy. In short, you check
the efficiency of the data model and thus try to optimize it for better
accurate prediction. Deployment deals with the launch of your model
and let the people outside there to benefit from that. You can also obtain
feedback from organizations and people to know their need and then to
work more on your model.
Fig 2.3
8
CHAPTER : 3
Machine Learning concepts and Applications
Machine learning (ML) allows computers to learn and make decisions without
being explicitly programmed. It involves feeding data into algorithms to
identify patterns and make predictions on new data. Machine learning is used
in various applications, including image and speech recognition, natural
language processing, and recommender systems.
9
3.3 Importance of Data in Machine Learning:
Data is the foundation of machine learning (ML). Without quality data,
ML models cannot learn, perform, or make accurate predictions.
Fig 3.0
Fig 3.1
10
CHAPTER : 4
PYTHON
Python is a programming language widely used by Data Scientists.
Fig 4.1
Fig 4.2
11
4.3 Key Libraries and Tools:
NumPy: A fundamental library for numerical operations in Python,
supporting large, multi-dimensional arrays and matrices.
Fig 4.3
Fig 4.4
12
4.5 Applications of Python:
Fig 4.5
Benefits of Python:
Fig 4.6
Fig 4.7
13
CHAPTER: 5
Python Syntax, Data Types & Operators
Python is known for its clean and readable syntax, which makes it an
excellent language for beginners and professionals working in AI, data
science, and software development.
Comments start with # and are ignored by the interpreter. Use them to explain
your code.
Variables do not require a type declaration; the type is inferred from the value
(e.g., x = 10).
Functions are defined using the def keyword, and blocks of code are
structured using colons (:) followed by indented lines.
Control structures like if, elif, else, for, and while are written in a natural,
readable way.
Example:
# This is a comment
def greet(name):
if name:
else:
14
print ("Hello, Guest!")
greet("Alice")
Python also supports a REPL (Read-Eval-Print Loop) mode, where you can
type Python code line by line and see immediate results. This makes it great
for quick testing and learning. Overall, Python's syntax emphasizes
readability, simplicity, and consistency, which is why it's so widely loved by
beginners and professionals alike.
Fig 5.1
15
◆ 1. Numeric Types
These include:
◆ 2. Sequence Types
◆ 3. Set Types
◆ 4. Mapping Type
◆ 5. Boolean Type
◆ 6. Binary Types
16
◆ 7. None Type
Example:
a = 10 # int
b = 3.14 # float
c = "Python" # str
d = [1, 2, 3] # list
e = {"key": 1} # dict
f = True # bool
Python also allows you to check the type of a variable using the built-in type()
function, and you can convert between types using type casting, such as int(),
float(), str(), etc. Understanding data types is foundational for writing correct
Python code, as operations and functions behave differently depending on the
type of data they work with.
5.3 Operators:
In Python, operators are special symbols or keywords used to perform
operations on variables and values. Python supports several types of
operators that enable arithmetic operations, comparisons, logical decisions,
bitwise manipulations, and more. These operators make it easier to write
expressions that carry out calculations and control flow in programs.
1. Arithmetic Operators
Example:
a=5
b=2
print (a + b) # 7
print (a ** b) # 25
17
Used to compare values and return a boolean result:
>= (Greater than or equal to), <= (Less than or equal to)
Example:
x = 10
y = 20
3. Logical Operators
Example:
a=5
4. Assignment Operators
Example:
x=5
x += 3 # x becomes 8
5. Bitwise Operators
18
Example:
a=5 # 0101
b=3 # 0011
6. Membership Operators
Example:
7. Identity Operators
Example:
x = [1, 2, 3]
y=x
print (x is y) # True
◆ Conditional Statements
These statements let your program make decisions based on certain
conditions. Python uses:
19
if – executes a block if the condition is true
Example:
x = 10
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
◆ Looping Statements
Loops are used to repeat a block of code multiple times.
Examples:
# for loop
for i in range (5):
print(i)
# while loop
i=0
while i < 5:
print(i)
i += 1
20
pass – does nothing, used as a placeholder
Example:
Python offers many powerful string methods to work with text, such as:
21
strip () – removes whitespace from both ends
Example:
word = "Python"
Python also supports string formatting, which allows you to embed variables
into strings:
22
There are basically 3 types of operators supported by string:
Basic Operators: There are two types of basic operators in string. They are
“+” and “*”.
1. Concatenation Operator (+): the concatenation operator concatenates
two strings and forms a new string.
2. Replication Operator (*): It is used to repeat a string number of times
the string will be repeated the number of times is given by the integer
value.
Membership operators: To test whether a value is present in a sequence.
Relational Operators: All the comparisons operators i.e., (<,>, <=,>=, == ,!=,
<>)
Slice Notation: String Slice can be defined as substring which is the part of
string. Therefore, further substring can be obtained from a string.
Strings in Python are versatile and essential, used in everything from simple
output messages to file handling, data parsing, and user input. Their
flexibility and the wide range of methods make them one of the most
important data types in Python.
23
CHAPTER:6
Functions and Scope in Python
In Python: functions, modules, and exception handling. These concepts help
developers write organized, reusable, and error-free code, making Python a
powerful and efficient programming language for AI, data science, and
software development.
• Built-in Functions such as print (), len (), and range ().
keyword.
• Lambda Functions, which are small anonymous functions used for quick,
short operations.
Example:
def greet(name):
Python also supports default arguments, where parameters can have default
values:
24
python
Copy
Edit
def greet(name="Guest"):
Python also allows anonymous functions using the lambda keyword. These
are short, one-line functions used for simple tasks, especially with functions
like map (), filter (), and sorted ().
Example:
square = lambda x: x * x
Local scope:
Variables declared within a function have local scope. They are
accessible only within the function in which they are defined.
Local variables are created when the function is called and
destroyed when it exits.
Local variables cannot be accessed from outside the function.
25
Global Scope:
Variables declared outside of any function or at the top level of a
script have global scope. They are accessible throughout the
program.
During program startup, global variables are created in memory
and remain there until the program ends.
Global variables can be accessed from any function within the
program.
Nested scope:
Python allows nested functions, where one function is defined
inside another.
During nested functions, the inner function has access to
variables in the outer (enclosed) function.
The inner function's scope is called "nested scope" because it
includes both its local scope and the enclosing function's scope.
26
CHAPTER: 7
Packages and Modules in Python
Introduction
Python is a high-level, general-purpose programming language widely used in
various domains including data science, machine learning, web development,
and automation. One of Python’s key strengths is its modular structure,
which allows developers to organize code into reusable components. This
modularity is achieved through the use of modules and packages, which play
a vital role in organizing, maintaining, and scaling Python projects effectively.
Modules in Python
A module is a file containing Python code that is written for reuse. It typically
consists of functions, classes, and variables that serve specific functionalities.
The primary goal of a module is to break down large programs into smaller,
manageable, and logically organized parts. This enhances code readability,
promotes reuse, and simplifies debugging and maintenance.
Modules form the foundational building blocks of Python programs. They can
be standard (built-in to Python), third-party (installed externally), or user-
defined (created by the developer). Using modules also allows for separation
of concerns, where each module is responsible for a specific part of the
program logic, reducing complexity in large codebases.
27
Packages in Python
A package is a hierarchical file structure that contains multiple modules
grouped together to form a collection of related functionalities. Packages allow
developers to organize their modules into directories, thereby creating a
scalable project structure. The presence of a special initialization file in the
directory indicates to Python that it should treat the directory as a package.
Packages are essential when working on large projects that involve multiple
components. By categorizing similar modules into packages, developers can
avoid naming conflicts, improve code organization, and enable better
navigation through the codebase. Packages can also contain sub-packages,
allowing for multi-level structuring of code.
28
repetitive processes, and collaborate effectively in a team environment. This
approach not only improved the quality of the code but also enhanced overall
productivity.
Modules in Python are essential components that allow programmers to
organize code into separate files and reuse functionality across different
programs. A module is simply a file containing Python code—such as
functions, classes, or variables—that can be imported and used in another
Python script. Python supports various types of modules, including built-in
modules like math, os, and datetime, which come pre-installed and provide
powerful features for mathematical operations, file handling, and date/time
manipulation. Users can also create their own custom modules, known as
user-defined modules, to structure their code better and enhance reusability.
Additionally, third-party modules like numpy, pandas, matplotlib, and flask
can be installed using Python’s package manager pip to perform specific tasks
such as data analysis, visualization, and web development. Modules can be
imported using the import statement, and specific functions or classes can be
brought in using from module import name. By using modules, Python
promotes modular programming, which leads to cleaner, more manageable
code, encourages reusability, reduces redundancy, and improves overall
program structure. Whether for small scripts or large applications, modules
play a vital role in efficient and effective Python development.
29
CHAPTER: 8
EXCEPTION HANDLING IN PYTHON
Introduction
In any programming language, errors are a natural part of the development
process. Python provides a structured way to detect and handle these errors
using a mechanism called exception handling. This allows programs to
respond to unexpected situations without crashing, thereby improving
robustness, user experience, and overall software reliability.
Understanding Exceptions
An exception is an event that occurs during the execution of a program that
disrupts the normal flow of instructions. Exceptions are not necessarily errors
in logic; they often result from conditions that are beyond the control of the
program, such as attempting to access a file that does not exist or dividing a
number by zero.
In Python, exceptions are objects that represent these error conditions. When
an exception occurs, Python immediately stops the current flow of the
program and looks for a way to handle the exception. If not handled, the
program terminates and displays an error message, commonly referred to as
a traceback.
30
An optional block for cleanup actions.
This mechanism provides flexibility and control over how different types of
exceptions are managed and ensures that the program can continue running
or exit gracefully.
Error Isolation: Helps identify exactly where the error occurred without
affecting the rest of the code.
31
During my internship in the field of data science, I encountered several
scenarios where exception handling became necessary—for instance, when
handling missing values, managing file loading issues, or connecting to
external databases. Implementing structured exception handling helped me
build resilient scripts that could run reliably in different environments with
varying data inputs.
Conclusion
Exception handling is a fundamental aspect of writing robust and
professional-grade Python applications. It allows developers to anticipate and
manage errors effectively, ensuring that programs behave predictably even
under unexpected conditions. In data science and other real-world
applications, the ability to handle exceptions gracefully not only improves
performance but also enhances the reliability and trustworthiness of the
system. My internship experience underscored the importance of mastering
exception handling to create stable, scalable, and user-friendly Python
solutions.
32
CHAPTER: 9
PYTHON DATA STRCTURES
Introduction
Data structures are the foundational building blocks of any programming
language. In Python, data structures are used to store, organize, and manage
data efficiently. They provide a means of performing operations on data and
are essential for solving complex computational problems. Python offers a rich
collection of built-in data structures that are both flexible and easy to use,
which makes the language especially powerful for data science and software
development.
Integers
Floats
Strings
Booleans
While not considered data structures in the traditional sense, these primitives
form the basis for more complex types.
These include more advanced structures that are capable of storing multiple
elements and performing operations on them. The primary non-primitive data
structures in Python are:
33
Dictionaries: Key-value pairs for efficient lookup and storage.
Python’s built-in data structures are often used in combination with third-
party libraries like pandas, which extends their functionality for handling
structured data such as tables and time series.
Ease of Use: The syntax and operations associated with Python’s data
structures are intuitive and user-friendly.
34
Tasks such as data cleaning, transformation, and aggregation were greatly
facilitated by using dictionaries, lists, and sets. Understanding the underlying
structure of data allowed me to implement faster and more reliable solutions,
especially when dealing with large-scale operations or real-time data.
Data structures also supported integration with various tools and libraries,
enabling seamless development of end-to-end data workflows.
35
Chapter:10
Lists, Tuples, Sets, Dictionaries and Strings in
Python
List
A list in Python is a dynamic, ordered collection that can store elements of
different data types such as integers, floats, strings, or even other lists (nested
lists). Lists are mutable, so you can change, add, or delete elements without
creating a new list. They are defined using square brackets []. Lists are
versatile and widely used for storing a sequence of items such as a list of
student names, shopping items, or daily temperatures.
Example:
print(fruits)
String
A string is a sequence of Unicode characters used to represent text. Strings
are immutable, meaning once created, their content cannot be changed. You
can perform various operations on strings like slicing, searching, formatting,
and joining. Strings are defined using single ' or double " quotes, and multiline
strings use triple quotes ''' or """.
36
replace () – replaces part of the string
Example:
python
Tuple
A tuple is a collection similar to a list but immutable, meaning once it's
created, you cannot add, remove, or change elements. Tuples are defined
using parentheses (). Because they are immutable, they can be used as
dictionary keys or elements in a set, which lists cannot do. Tuples are
usually used when the data should not be changed throughout the program,
like coordinates (x, y) or months of the year.
Common operations:
Example:
python
Output = 20
Advantages:
Dictionary
A dictionary is an unordered, mutable collection of key-value pairs. Each
key must be unique and immutable (like strings, numbers, or tuples).
Dictionaries are written using curly braces {}. They are commonly used to
store data like student records, configurations, or any structured data.
37
Common methods:
Example:
python
print(student["name"])
Output = Alice
Use Cases:
Set
A set is a collection of unordered, unique items. Sets are useful when you
want to ensure there are no duplicate entries. Sets are mutable, meaning you
can add or remove elements, but they do not support indexing or slicing
because they are unordered. Sets are ideal for operations like union,
intersection, and difference between groups.
Common methods:
Example:
python
set1 = {1, 2, 3}
38
set2 = {3, 4, 5}
Output = {3}
39
Chapter: 11
Files and File Handling in Python
Files and File Handling in Python
In Python, file handling allows you to create, read, write, and delete files
directly from your Python program. This is especially useful when you want
to store data permanently, process text files, or interact with external files like
logs, reports, or configurations. Python provides built-in functions for file
handling, and the most common one is the open () function. This function is
used to open a file and returns a file object, which lets you perform various
operations on the file.
Add "b" for binary mode (e.g., "rb" for read binary)
To write to a file, use write () or writelines (). After you're done working with a
file, it’s important to close it using close () to free up system resources.
However, the better way to handle files in Python is using a with block (also
called a context manager), which automatically closes the file when done.
Example (writing and reading a file):
python
# Writing to a file
file.write("Python is fun!")
40
# Reading from a file
content = file.read()
print(content)
41
Chapter: 12
Regular Expressions in Python
Regular Expressions (commonly abbreviated as RegEx) are powerful tools
used in Python to search, match, and manipulate strings based on specific
patterns. They are especially useful when you need to validate input (like
emails or phone numbers), extract specific parts of text, or perform complex
text replacements. Python provides the re module for working with regular
expressions. To use it, you must import it with import re.
? – matches 0 or 1 repetition
Example:
python
import re
42
text = "My phone number is 9876543210"
if match:
Regular expressions can be tricky at first, but they are incredibly powerful
once mastered. You can build anything from simple string filters to complex
parsers. Python also allows the use of flags like re.IGNORECASE or
re.MULTILINE to control how matching is done.
43
CHAPTER : 13
CONCLUSION
Data Science stands at the forefront of the digital revolution, playing a pivotal
role in transforming raw data into meaningful insights that drive strategic
decisions. It is a multidisciplinary field that blends mathematics, statistics,
programming, and domain knowledge to solve real-world problems. From
healthcare and finance to agriculture and entertainment, data science is being
used to optimize operations, predict future trends, personalize user
experiences, and automate tasks through artificial intelligence and machine
learning.
44