Training Report II
Training Report II
On
PYTHON
Submitted to MAHARAJA RANJIT SINGH PUNJAB TECHNICAL
UNIVERSITY in partial fulfillment of the requirement for the award of
the degree of
B.TECH
in
COMPUTER SCIENCE &
ENGINEERING
Submitted By
SUDHANSU MAURYA
Roll No. 180280073
JULY 2020
TRAINING REPORT
On
PYTHON
Submitted to MAHARAJA RANJIT SINGH PUNJAB TECHNICAL
UNIVERSITY in partial fulfillment of the requirement for the award of
the degree of
B.TECH
in
COMPUTER SCIENCE &
ENGINEERING
Submitted By
SUDHANSU MAURYA
CERTIFICATE OF TRAINING
PREFACE
Training is an integral part of B.Tech and each and every student has to undergo the
training for 6 or 8 weeks in a company.
This record is concerned about our practical training during the 5 th semester of our
B.Tech. We have taken our Practical training in Python. During this training, we got to
learn many new things about the industry and the current requirements of companies.
This training proved to be a milestone in our knowledge of present industry. Every say
and every moment was an experience in itself, an experience which theoretical study
can’t provide.
ACKNOWLEDGEMENT
It is my pleasure to be indebted to various people, who directly or indirectly
contributed in the development of this work and who influenced my thinking, behavior
and acts during the course of study.
I express my sincere gratitude to Dr. Dinesh Kumar worthy HOD and Er. Naresh
Garg and Er. Manpreet Kaur, Training & Placement In-charge for providing me an
opportunity to undergo summer training at INTERNSHALA ONLINE TRAININGS.
Lastly, I would like to thank the almighty and my parents for their moral support and
my friends with whom I shared my day-to-day experience and received lots of
suggestions that my quality of work.
SUDHANSU MAURYA
CANDIDATE’S DECLARATION
I, SUDHANSU MAURYA Roll No. 180280073, B.Tech (Semester- V) of the Gaini
Zail Singh Campus College of Engineering & Technology, Bathinda hereby
declare that the Training Report entitled “PYTHON” is an original work and data
provided in the study is authentic to the best of my knowledge. This report has not
been submitted to any other Institute for the award of any other degree.
SUDHANSU MAURYA
Place: Bathinda
INDEX
SR. NO. TOPIC PAGE
NO.
1. INTRODUCTION
2. HISTORY OF PYTHON
3. WHY PYTHON
4. CHARACTERISTICS OF
PYTHON
6. FUNCTION
7. OOPs
8. USE NUMPY
9. PROJECT
10. CONCLUSION
INTRODUCTION
Python is a widely used general-purpose, high level programming
language. It was created by Guido van Rossum in 1991 and further
developed by the Python Software Foundation. It was designed with an
emphasis on code readability, and its syntax allows programmers to
express their concepts in fewer lines of code.
Python is a programming language that lets you work quickly and
integrate systems more efficiently.
There are two major Python versions: Python 2 and Python 3. Both
are quite different.
Beginning with Python programming:
1) Finding an Interpreter:
Before we start Python programming, we need to have an interpreter to
interpret and run our programs. There are certain online interpreters
like https://ide.geeksforgeeks.org/ , http://ideone.com/ or
http://codepad.org/ that can be used to run Python programs without
installing an interpreter.
Windows: There are many interpreters available freely to run Python
scripts like IDLE (Integrated Development Environment) that comes
bundled with the Python software downloaded from http://python.org/.
Linux: Python comes preinstalled with popular Linux distros such as
Ubuntu and Fedora. To check which version of Python you’re running,
type “python” in the terminal emulator. The interpreter should start and
print the version number.
macOS: Generally, Python 2.7 comes bundled with macOS. You’ll
have to manually install Python 3 from http://python.org/.
HISTORY OF PYTHON
WHY PYTHON
CHARACTERISTICS OF PYTHON
Features in Python
There are many features in Python, some of which are discussed below
–
1. Easy to code:
Python is a high-level programming language. Python is very easy to
learn the language as compared to other languages like C, C#,
Javascript, Java, etc. It is very easy to code in python language and
anybody can learn python basics in a few hours or days. It is also a
developer-friendly language.
2. Free and Open Source:
Python language is freely available at the official website and you can
download it from the given download link below click on the Download
Python keyword.
Download Python
Since it is open-source, this means that source code is also available to
the public. So you can download it as, use it as well as share it.
3. Object-Oriented Language:
One of the key features of python is Object-Oriented programming.
Python supports object-oriented language and concepts of classes,
objects encapsulation, etc.
4. GUI Programming Support:
Graphical User interfaces can be made using a module such as
PyQt5, PyQt4, wxPython, or Tk in python.
PyQt5 is the most popular option for creating graphical apps
with Python.
5. High-Level Language:
Python is a high-level language. When we write programs in
python, we do not need to remember the system architecture,
nor do we need to manage the memory.
6. Extensible feature:
Python is a Extensible language. We can write us some Python
code into C or C++ language and also we can compile that
code in C/C++ language.
7. Python is Portable language:
Python language is also a portable language. For example, if we
have python code for windows and if we want to run this code
on other platforms such as Linux, Unix, and Mac then we do not
need to change it, we can run this code on any platform.
8. Python is Integrated language:
Python is also an Integrated language because we can easily
integrated python with other languages like c, c++, etc.
9. Interpreted Language:
Python is an Interpreted Language because Python code is
executed line by line at a time. like other languages C, C++,
Java, etc. there is no need to compile python code this makes it
easier to debug our code. The source code of python is
converted into an immediate form called bytecode.
10. Large Standard Library
Python has a large standard library which provides a rich set of
module and functions so you do not have to write your own
code for every single thing. There are many libraries present in
python for such as regular expressions, unit-testing, web
browsers, etc.
11. Dynamically Typed Language:
Python is a dynamically-typed language. That means the type
(for example- int, double, long, etc.) for a variable is decided at
run time not in advance because of this feature we don’t need
to specify the type of variable.
Attention geek! Strengthen your foundations with the Python
Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data
Structures concepts with the Python DS Course.
3. Tuple : Python tuples work exactly like Python lists except they
are immutable, i.e. they can’t be
changed in place. They are normally written inside parentheses to
distinguish them from lists (which use square brackets), but as
you’ll see, parentheses aren’t always necessary. Since tuples are
immutable, their length is fixed. To grow or shrink a tuple, a new
tuple must be created.
Here’s a list of commonly used tuples:
FUNCTION
OOPs
Arrays in Numpy
PROJECT
Colors Dataset
The colors.csv file includes 865 color names along with their
RGB and hex values.
import argparse
ap = argparse.ArgumentParser()
args = vars(ap.parse_args())
img_path = args['image']
img = cv2.imread(img_path)
index=["color","color_name","hex","R","G","B"]
cv2.setMouseCallback('image',draw_function)
if event == cv2.EVENT_LBUTTONDBLCLK:
clicked = True
xpos = x
ypos = y
b,g,r = img[y,x]
b = int(b)
g = int(g)
r = int(r)
6. Calculate distance to get color name
def getColorName(R,G,B):
minimum = 10000
for i in range(len(csv)):
if(d<=minimum):
minimum = d
cname = csv.loc[i,"color_name"]
return cname
while(1):
cv2.imshow("image",img)
if (clicked):
cv2.putText(img, text,(50,50),2,0.8,
(255,255,255),2,cv2.LINE_AA)
if(r+g+b>=600):
cv2.putText(img, text,(50,50),2,0.8,
(0,0,0),2,cv2.LINE_AA)
clicked=False
#Break the loop when user hits 'esc' key
break
cv2.destroyAllWindows()
The beginner Python project is now complete, you can run the
Python file from the command prompt. Make sure to give an
image path using ‘-i’ argument. If the image is in another
directory, then you need to give full path of the image: