Professional Documents
Culture Documents
Ashutosh Uadhyay - PCE20CS033 - 7CS-A - Indust - Training Report (1) - 1
Ashutosh Uadhyay - PCE20CS033 - 7CS-A - Indust - Training Report (1) - 1
Bachelor of Technology In
Computer Engineering
(Session 2023-24)
DEPARTMENT OF COMPUTER
ENGINEERING POORNIMA COLLEGE OF
ENGINEERING, JAIPUR RAJASTHAN
TECHNICAL UNIVERSITY, KOTA
OCTOBER, 2023
DECLARATION
I hereby declare that the work which is being presented in the Industrial Training report
titled Python in partial fulfillment for the award of the Degree of Bachelor of
Technology in Computer Engineering and submitted to the Department of Computer
Engineering, Poornima College of Engineering, Jaipur, is an authentic record of my
own work carried out at Aryan Infomatrix Pvt. Ltd. during the session 2023-24.
I have not submitted the matter presented in this report anywhere for the award of any
other Degree.
i
ii
DEPARTMENT OF COMPUTER ENGINEERING
Date: 30/10/2023
CERTIFICATE
This is to certify that Industrial Training report Python developer has been
iii
ACKNOWLEDGEMENT
My special heartfelt gratitude goes to Dr. Nikita Jain, Deputy Head (Academics),
Department of Computer Engineering, Poornima College of Engineering, for
unvarying support, guidance and motivation during the course of this research.
I am deeply thankful to my parents and all other family members for their blessings
and inspiration. At last, but not least I would like to give special thanks to God who
enabled me to complete my training work on time.
Ashutosh Upaddhyay(PCE20CCS033)
iv
TABLE OF CONTENTS
Title Page 0
Declaration i
Training Certificate from Company ii
Certificate by the Department iii
Acknowledgment iv
Table of Contents v-vi
List of Tables vii
List of Figures viii
Abstract 9
Chapter 1: Introduction 10-12
1.1 About company 10
1.2 Training Platform 11
1.3 Training Starting Date 11
1.4 Training Ending Date 11
1.5 Total Training Duration 11
1.6 Date of Certification 12
1.7 Conclusion 12
v
Chapter 2: Python 13-22
2.1 Introduction 13
2.2 Scripting Language 14
2.3 Object Oriented Programming 14
2.4 History 14-15
2.5 Operators in Python 16
2.6 Types of Operators in Python 16-22
vi
LIST OF TABLES
vii
LIST OF FIGURES
viii
ABSTRACT
The objective of the practical training is to learn something about industries practically
and to be familiar with a working style of a technical worker to adjust according to
industrial environment. This report deals with the equipment’s their general operating
principle.
Python, an interpreted language which was developed by Guido Van Rossum came
into implementation in1989.The language supports both object oriented and procedure
oriented approach. Python is designed to be a highly extensible language. Python
works on the principle of ―there is only one obvious way to do a task‖ rather than
―there is more than one way to solve a particular problem‖. Python is very easy to
learn and implement. The simpler syntax, uncomplicated semantics and approach with
which Python has been developed makes it easier to learn. A large number of python
implementation and extensions have been developed since its inception.
Training Cover provides both three weeks as well as three months industrial training in
Python.
Python is divided into two parts as ―Core Python and ―Advance Python.
Accordingly, all the basic and advanced topics are discussed in both of the modules.
1
CHAPTER 1
INTRODUCTION
Fig.-1
2
Fig.-2
1.2 PYTHON
I got the training there on Python. Python is a widely used high-level, general-purpose,
interpreted, dynamic programming language. Its design philosophy emphasizes code
readability, and its syntax allows programmers to express concepts in fewer lines of
code than would be possible in languages such as C++ or Java. The language provides
constructs intended to enable clear programs on both a small and large scale. Python
supports multiple programming paradigms, including object-oriented, imperative and
functional programming or procedural styles. It features a dynamic type system and
automatic memory management and has a large and comprehensive standard library.
3
Python interpreters are available for installation on many operating systems, allowing
Python code execution on a wide variety of systems.
1.2.1 Training Starting Date:
It was a good experience to work there along with the Aryan Infomatrix team. I
reported there on 1st August, 2023.
1.2.2 Training Ending Date:
My Training there at Aryan Infomatrix Pvt. Ltd. Formally got completed after a
fortnight on 15th Spetember 2023.
1.2.3 Total Training Duration:
My training was originally for a fortnight but on my request they extended it to 45 days.
1.2.4 Date of Certification:
I got my training certificate on 30th of September 2023 although in digital format.
1.2.5 Conclusion
This was my first training as an Engineering Student that too in the time of Pandemic,
but I enjoyed working with the Aryan Infomatrix Pvt. Ltd teams and being there. The
people are very much cooperative and helpful. Apart from my technical learning on
Python, I also get to learn may other behavioral things of a corporate life, the schedule,
and the meetings. I also got to know about different things. I had some knowledge
about DB tool SALSFORCE and Virtual Reality as well. So, from my perspective it
was overall a fruitful trip to the Corporate Life.
4
Chapter 2
PYTHON
2.1 Introduction
Python is a widely used high-level, general-purpose, interpreted, dynamic
programming language. Its design philosophy emphasizes code readability, and its
syntax allows programmers to express concepts in fewer lines of code than would be
possible in languages such as C++ or Java. The language provides constructs intended
to enable clear programs on both a small and large scale. Python supports multiple
programming paradigms, including object-oriented, imperative and functional
programming or procedural styles. It features a dynamic type system and automatic
memory management and has a large and comprehensive standard library. Python
interpreters are available for installation on many operating systems, allowing Python
code execution on a wide variety of systems.
2.2 Scripting Language
A scripting or script language is a programming language that supports scripts,
programs written for a special run-time environment that automate the execution of
tasks that could alternatively be executed one-by-one by a human operator. Scripting
languages are often interpreted (rather than compiled). Primitives are usually the
elementary tasks or API calls, and the language allows them to be combined into more
complex programs.
2.3 Object Oriented Programming Language
Object-oriented programming (OOP) is a programming paradigm based on the concept
of "objects", which may contain data, in the form of fields, often known as attributes;
and code, in the form of procedures, often known as methods. A distinguishing feature
of objects is that an object's procedures can access and often modify the data fields of
the object with which they are associated (objects have a notion of "this" or "self"). In
5
OO programming, computer.
Programs are designed by making them out of objects that interact with one another.
There is significant diversity in object oriented programming, but most popular
languages are class- based, meaning that objects are instances of classes, which
typically also determines their type.
2.4 History
Python was conceived in the late 1980s, and its implementation was started in
December 1989 by Guido van Rossum at CWI in the Netherlands as a successor to the
ABC language (itself inspired by SETL) capable of exception handling and interfacing
with the Amoeba operating system. Van Rossum is Python's principal author, and his
continuing central role in deciding the direction of Python is reflected in the title given
to him by the Python community, benevolent dictator for life (BDFL).
• Python Features
• Python Features #Easy-to-learn Python has few keywords, simple structure,
and a clearly defined syntax. This allows the student to pick up the language
quickly.
• Easy-to-read Python code is more clearly defined and visible to the eyes.
• Easy-to-maintain Python's source code is fairly easy-to-maintain
• A broad standard library Python's bulk of the library is very portable and
crossplatform compatible on UNIX, Windows, and Macintosh.
• Interactive Mode Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.
• Portable Python can run on a wide variety of hardware platforms and has the
same interface on all platforms.
• Extendable You can add low-level modules to the Python interpreter. These
modules enable programmers to add to or customize their tools to be more
6
efficient.
• Databases Python provides interfaces to all major commercial databases.
• GUI Programming Python supports GUI applications that can be created
and ported to many system calls, libraries and windows systems, such as
Windows MFC, Macintosh, and the X Window ...
• Scalable Python provides a better structure and support for large programs
than shell scripting.
Apart from the above-mentioned features, Python has a big list of good features, few are
listed below −
• Identity Operators
Fig.-6
Let us have a look on all operators one by one.
2.6.1 Python Arithmetic Operators
Assume variable a holds 10 and variable b holds 20, then –
Operator Description Example
+ Addition Adds values on either side of the a + b = 30
operator.
Subtracts right hand operand from left
- Subtraction hand operand. a – b = -10
* Multiplication Multiplies values on either side of the a * b = 200
operator
Divides left hand operand by right
/ Division hand operand b/a=2
Divides left hand operand by right hand
% Modulus b%a=0
operand and returns remainder
Performs exponential (power) a**b =10 to
** Exponent
calculation on operators the power
20
8
2.6.2 Python Comparison Operators
These operators compare the values on either sides of them and decide the relation
among them. They are also called Relational operators.
9
Operator Description Example
c=a+b
Assigns values from right side operands
= assigns value
to left side operand
of a + b into c
10
and b = 13; Now in the binary format their values will be 0011 1100 and 0000 1101
respectively. Following table lists out the bitwise operators supported by Python
language with an example each in those, we use the above two variables (a and b) as
operands − a = 0011 1100 b = 0000 1101
(~a ) = -61
(means 1100
~ Binary Ones It is unary and has the effect of 'flipping' 0011 in 2's
Complement bits. complement
form due to a
signed binary
number.
a << 2 = 240
<< Binary The left operands value is moved left
(means 1111
Left by the number of bits specified by the
0000)
Shift right operand.
11
a >> 2 = 15
>> Binary The left operands value is moved right
(means 0000
Right by the number of bits specified by the
1111)
Shift right operand.
Table-4
2.6.5 Python Logical Operators
There are following logical operators supported by Python language. Assume variable
a holds 10 and variable b holds 20 then
Operator Description Example
and Logical If both the operands are true then
(a and b) is true.
AND condition becomes true.
If any of the two operands are non-zero
or Logical OR (a or b) is true.
then condition becomes true.
not Logical Not (a and b)
Used to reverse the logical state of its
NOT operand. is false.
Table-5
12
2.7 Python Operators Precedence
The following table lists all operators from highest precedence to lowest.
Sr.No. Operator & Description
**
1 Exponentiation (raise to the power)
~+-
2 Complement, unary plus and minus (method names for
the last two are +@ and -@)
* / % //
3 Multiply, divide, modulo and floor division
+-
4 Addition and subtraction
>> <<
5
Right and left bitwise shift
&
6
Bitwise 'AND'
^|
7
Bitwise exclusive `OR' and regular `OR'
<= < > >=
8
Comparison operators
9 <> == !=
Equality operators
= %= /= //= -= += *= **=
10
Assignment operators
is is not
11
Identity operators
in not in
12
Membership operators
not or and
13
Logical operators
13
Table-7
In Python, operators are special symbols that designate that some sort of computation
should be performed.
Python supports the usual logical conditions from mathematics:
• Equals: a = = b
• Not Equals: a != b
• Less than: a < b
• Less than or equal to: a <= b
• Greater than: a > b
• Greater than or equal to: a >= b
These conditions can be used in several ways, most commonly in "if statements" and
loops. We will see it in next chapter.
14
CHAPTER 3
COLLECTION IN PYTHON
Collections in python are basically container data types, namely list, sets, tuples
and dictionary. They have different characteristics based on the declaration and the
usage.
15
Fig.-7
What is Data types in Python?
Data types are used in Python to classify a particular type of data. It is important
because the specific type of information you use will determine which values you can
assign and what you can do. Every Python value has a data type. In Python
programming, everything is an object, data types are classes, and variables are instance
(object) of these classes.
The instance () function is also used to check whether an object belongs to a specific
class. There are several data types in Python. Let‘s take a look at the data types in
Python.
All lists in Python are zero-based indexed. When the member or the length of
a list is referenced, the number of list elements is always the number plus one.
3.2.2 Python Tuple
A tuple is an ordered sequence of items, like a list. The only difference is that
tuples are immutable. Tuples cannot be modified once they have been created.
Tuples are used to write protection data and are usually faster than lists since
they cannot dynamically change.
Tuples are defined by parenthesis () where commas separate items. t
= (Computers,'96', 1+4j)
We can use the slicing operator [] to extract items but we cannot change its value.
t = ('Computers',96,
1+4j)
print("t[1] = ", t[1])
print("t[0:3] = ",
t[0:3])
everything you ever do with it is to iterate through it, use a tuple rather than
a list.
• Your code becomes more secure if you 'write-protect' data that need not be
changed.
3.2.3 Python Strings:
String is sequence of Unicode characters. We can use single, double or triple
quotes to represent strings. Multi-line strings can be denoted using triple quotes,
‖‘ or ―‖‖.
str = "String is sequence of Unicode
characters"
print(str)
str = '''String is sequence of
Unicode characters'''
print(str)
Output:
Python can format multiple strings and numbers using a special syntax. The
string format is quickly covered here because it is often seen and the syntax must
recognize.
print "The item {} is repeated {} times".format(element,count))
The {} is a placeholder that is replaced by the element of the variables and count
in the final string—this compact syntax designed to keep the code readable and
compact.
18
by values that are separated by a comma within { } braces. A set object has
appropriate methods to perform mathematical set operations such as union,
intersection, difference, etc.
19
after they are created.
Items in a list or dictionary object can be modified. It is possible to add, delete,
insert, and rearrange items in a list or dictionary. They are mutable objects.
20
CHAPTER 4
CONDITIONALS and LOOPS in PYTHON
• If statement.
• If Else statement.
• Elif statement.
• Nested if statement.
• Nested if else statement.
4.1 If statement
A Python if statement evaluates whether a condition is equal to true or false. The
statement will execute a block of code if a specified condition is equal to true.
Otherwise, the block of code within the if statement is not executed.
Syntax
1. if(condition):
2. {
3. #if statement
4. }
Example
21
Output: a is less than b
4.2 If else statement
If else is a conditional statement. The statement itself says that if a given
condition is true or false. True means executing the ―if‖ statement to the
output. False means executing the
―else‖ statement to the output.
Syntax
1. if(condition):
2. {
3. # if statement
4. }
5. else:
6. {
7. # else statement
8. }
Example
Program for if else statement
1. a = 10
2. b = 20
3. if a==b:
4. print("a and b are equal")
5. else:
6. print("a and b are not equal")
Example
Program for elif statement
1. a = 10
2. b = 10
3. if a < b:
4. print("a is greater than b")
5. elif a == b:
6. print("a and b are equal")
7. else:
8. print("b is greater than a")
1. if(condition):
2. {
3. if(condition):
4. {
5. # if statement
6. }
7. }
Syntax
Example
Program for nested if statement
1. a= 1001
2. if a> 100:
3. print("Above 100")
4. if a > 1000:
5. print("and also 1000")
23
above
1. if(condition):
2. {
3. if(condition):
4. {
5. #if statement
6. }
7. else:
8. {
9. #else statement
10. }
11. }
12. else:
13. {
14. #else statement
15. }
Syntax
Example
Program for nested if else statement
24
>> 21
>> below 100
4.6 PYTHON-LOOPS
In general, statements are executed sequentially: The first statement in a function is
executed first, followed by the second, and so on. There may be a situation when you
need to execute a block of code several number of times.
Programming languages provide various control structures that allow for more
complicated execution paths.
A loop statement allows us to execute a statement or group of statements multiple
times. The following diagram illustrates a loop statement −
Fig.-8
25
Python has two primitive loop commands:
• While loops
• For loops
Python programming language provides following types of loops to handle
looping requirements.
Sr.No. Loop Type & Description
while loop
1
Repeats a statement or group of statements while a given
condition is TRUE. It tests the condition before
executing the loop body.
for loop
2
Executes a sequence of statements multiple times and
abbreviates the code that manages the loop
variable.
nested loops
3
You can use one or more loop inside any another while,
for or do while loop.
Table-8
• For Loop
A for loop is used for iterating over a sequence (that is either a list, a tuple, a
dictionary, a set, or a string).
This is less like the for keyword in other programming languages, and works
26
more like an iterator method as found in other object-orientated programming
languages.
Syntax
Example
Output: 15
• While Loop
With the while loop we can execute a set of statements as long as a condition is
true.
Example
Output: 1
2
3
4
5
27
4.7 Loop Control Statements
Loop control statements change execution from its normal sequence. When
execution leaves a scope, all automatic objects that were created in that scope
are destroyed.
Python supports the following control statements. Click the following links to
check their detail.
Let us go through the loop control statements briefly
Sr.No. Control Statement & Description
break statement
1
Terminates the loop statement and transfers execution to the
statement immediately following the loop.
continue statement
2
Causes the loop to skip the remainder of its body and
immediately retest its condition prior to
reiterating.
pass statement
3
The pass statement in Python is used when a statement is
required syntactically but you do not want any command or
code to execute.
Table-9
28
CHAPTER 5
FUNCTIONS IN PYTHON
30
parameters.
5.3.3 Default arguments
A default argument is an argument that assumes a default value if a value is not
provided in the function call for that argument.
5.3.4 Variable-length arguments
You may need to process a function for more arguments than you specified while
defining the function. These arguments are called variable-length arguments and
are not named in the function definition, unlike required and default arguments.
Syntax for a function with non- keyword variable arguments is this −
An asterisk (*) is placed before the variable name that holds the values of all
nonkeyword variable arguments. This tuple remains empty if no additional
arguments are specified during the function call.
5.4 The return Statement
The statement return [expression] exits a function, optionally passing back an
expression to the caller. A return statement with no arguments is the same as
return None.
All the above examples are not returning any value. You can return a value
from a function as follows −
#!/usr/bin/python# Function definition is here
def sum( arg1, arg2 ): # Add both the parameters and return
them." total = arg1 + arg2 print "Inside the function : ",
total
return total;# Now you can call sum function total =
sum( 10, 20 );
print "Outside the function : ", total
When the above code is executed, it produces the following result − Inside
the function : 30Outside the function : 30
31
5.5 Scope of Variables:
All variables in a program may not be accessible at all locations in that program.
This depends on where you have declared a variable.
The scope of a variable determines the portion of the program where you can
access a particular identifier. There are two basic scopes of variables in Python −
• Global variables
• Local variables
5.5.1 Global vs. Local variables
Variables that are defined inside a function body have a local scope, and those
defined outside have a global scope.
This means that local variables can be accessed only inside the function in which
they are declared, whereas global variables can be accessed throughout the
program body by all functions. When you call a function, the variables declared
inside it are brought into scope.
32
CHAPTER 6
CHATBOT
Nobody likes to be alone always, but sometimes loneliness could be a better medicine
to hunch the thirst for a peaceful environment. Even during such lonely quarantines,
we may ignore humans but not humanoids. Yes, if you have guessed this article for a
chatbot, then you have cracked it right. We won’t require 6000 lines of code to create
a chatbot but just a six-letter word “Python” is enough. Let us have a quick glance at
Python’s ChatterBot to create our bot. ChatterBot is a Python library built based on
machine learning with an inbuilt conversational dialog flow and training engine. The
bot created using this library will get trained automatically with the response it gets
from the user.
Types of Chatbots
Chatbots deliver instantly by understanding the user requests with pre-defined rules and
AI based chatbots. There are two types of chatbots.
33
• Rule Based Chatbots: This type of chatbots answer the customer queries using
the pre- defined rules. These bots answer common queries such as hours of
operation of business, addresses, phone numbers and tracking status.
• Conversational AI Chatbots: This type of chatbots using Natural language
Processing(NLP) to understand the context and intent of a user input before
providing the response. These Bots train themselves as per the user inputs and
more they learn, more they become user interactive.
Chatbots using python are a nifty tool since they facilitate instant messaging between
the brand and the customer. Think about Apple’s Siri, Amazon’s Alexa, and Microsoft’s
Cortana. Aren’t these just wonderful? Aren’t you already curious to learn how to make
a chatbot in Python?
Chatbots using python are a nifty tool since they facilitate instant messaging between
the brand and the customer. Think about Apple’s Siri, Amazon’s Alexa, and Microsoft’s
Cortana. Aren’t these just wonderful? Aren’t you already curious to learn how to make
a chatbot in Python?
Although chatbot in python has already begun to dominate the tech scene at present,
Gartner predicts that by 2020, chatbots will handle nearly 85% of the customer-brand
interactions.
34
In light of the increasing popularity and adoption of chatbots in the industry, you can
increase your market value by learning how to make a chatbot in Python – one of the
most extensively used programming languages in the world.
ChatterBot Library
ChatterBot is a Python library that is designed to deliver automated responses to user
inputs. It makes use of a combination of ML algorithms to generate many different types
of responses. This feature allows developers to build chatbots using python that can
converse with humans and deliver appropriate and relevant responses. Not just that,
the ML algorithms help the bot to improve its performance with experience.
The program chooses the most-fitting response from the closest statement that matches
the input, and then delivers a response from the already known selection of statements
and responses. Over time, as the chatbot engages in more interactions, the accuracy of
response improves. You may create your own chatbot project to understand the details
of this technology.
35
How To Make A Chatbot In Python?
To build a chatbot in Python, you have to import all the necessary packages and
initialize the variables you want to use in your chatbot project. Also, remember that
when working with text data, you need to perform data preprocessing on your dataset
before designing an ML model.
2 Import Classes
Importing classes is the second step in the Python chatbot creation process. All
you need to do is import two classes – ChatBot from chatterbot and ListTrainer
from chatterbot.trainers. To do this, you can execute the following command:
36
Since you have to provide a list of responses, you can do it by specifying the lists of
strings that can be later used to train your Python chatbot, and find the best match for
each query. Here’s an example of responses we can train the chatbot using python to
learn:
37
38
sReferences
• https://www.tutorialspoint.com/python/index.htm
• https://www.w3schools.com/python/default.asp
• https://www.jupternotebook.org/
• https://www.coursera.org/in
• https://www.python.org/
• Python: The Complete Reference by TMH Publication
• Python Programming |A modular approach by Pearson
Publication
39