31 Merged
31 Merged
on
PYTHON
Submitted to
J. Bhavya
20F11A0431
Under the Guidance of
Mrs.V.Devika, M.Tech
Assistant Professor-Department of ECE
2024
NARAYANA ENGINEERING COLLEGE :: GUDUR
(An Autonomous College Under JNTUA )
2024
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING
BONAFIDE CERTIFICATE
This is to certify that the internship entitled “Python” is being submitted by J.Bhavya
(20F11A0431) in partial fulfillment of the requirements for the award of degree of Bachelor of
Technology in ELECTRONICS AND COMMUNICATION ENGINEERING, NARAYANA
ENGINEERING COLLEGE, GUDUR, an Autonomous college Under JNTUA Ananthapuramu is
recorded to be the bonafide work carried out by him/her under my guidance and supervision.
I hereby declare that the Internship entitled “PYTHON INTERN, Slash Mark” is an Original
work submitted by me to the Department of Electronics and Communication
Engineering, NARAYANA ENGINEERING COLLEGE, GUDUR and I have not
submitted the same to any other University or Institute for the award of any Degree.
J. Bhavya
20F11A0431
Place: Gudur
Date:
4
ABSTRACT
This internship program offers a comprehensive dive into the world of Python
programming, focusing on practical applications and experiential learning. Over the course of
the internship, participants will immerse themselves in Python's versatile ecosystem, gaining
hands-on experience in various domains such as web development, data analysis, machine
learning, and automation. I am eager to apply for the Python internship opportunity at your
esteemed organization, driven by a strong passion for programming and a deep appreciation
for Python's versatility and power. With a solid foundation in computer science, I have honed
my skills through coursework and personal projects that emphasize Python's capabilities in
data analysis, web development, and automation. My experience includes developing efficient
scripts to automate repetitive tasks, creating web applications using frameworks like Django
and Flask, and analyzing large datasets with libraries such as Pandas and NumPy.
Additionally, I have a keen interest in machine learning, evidenced by projects where I
implemented algorithms using TensorFlow and Scikit- learn. I am confident that my problem-
solving abilities, combined with my enthusiasm for continuous learning and collaboration,
make me a valuable addition to your team. I am excited about the opportunityto contribute to
real-world projects and grow professionally under the guidance of experienced mentors at your
company.
5
LIST OF CONTENT
1.1 Objective 09
1.2 Reference 09
2.1 History 11
2.2 Features 11
2.7 Strings 15
3. Control Structures 17
3.1 Conditions 17
3.2 Loops 18
6
6. Django Framework 25
7. Conclusion 29
8. Internship Outcomes 30
7
CHAPTER-1
ABOUT THE COMPANY
Slash Mark IT is a dynamic startup that has quickly made a name for itself in the tech
industry. Founded by a group of innovative engineers and business strategists, the company
aims to revolutionize the way businesses approach information technology. With a core focus
on providing cutting-edge solutions, Slash Mark IT specializes in a wide array of services
including cloud computing, cybersecurity, software development, and IT consulting. Their
cloud computing solutions enable businesses to scale efficiently and securely, offering
flexibility and reduced operational costs. In the realm of cybersecurity, Slash Mark IT
employs advanced technologies and methodologies to protect client data from increasingly
sophisticated threats. The software development team is adept at creating custom applications
tailored to meet the specific needs of their clients, ensuring high performance and user
satisfaction. Furthermore, their IT consulting services provide invaluable insights and
strategies that help businesses optimize their IT infrastructure, leading to improved
productivity and competitive advantage. The startup’s commitment to innovation, customer
satisfaction, and excellence is evident in every project they undertake. With a team of highly
skilled professionals, Slash Mark IT is poised to lead the industry into a new era of
technological advancement, helping businesses of all sizes navigate the complexities of the
digital landscape. As they continue to grow, Slash Mark IT remains dedicated to its mission of
delivering top-notch IT solutions that drive success and foster long-term partnerships with
their clients.
8
1.1 Objective
The primary objective of the Python internship is to provide interns with hands-on
experience and practical knowledge in Python programming, fostering their development into
proficient and capable software developers. This internship is designed to achieve the
following specific goals:
➢ Skill Development: Enhance interns' understanding of Python programming, including core
concepts, syntax, and advanced features. This includes object-oriented programming, data
structures, algorithms, and libraries such as NumPy, Pandas, and Flask/Django forweb
development.
➢ Practical Experience: Offer real-world coding experience through involvement in active
projects. Interns will work on tasks that mirror the challenges faced in a professional
environment, including debugging, code reviews, and version control using Git.
➢ Project Management: Introduce interns to software development lifecycle processes,
including requirement analysis, design, implementation, testing, and deployment. This
helps interns understand the importance of planning and documentation.
➢ Portfolio Development: Enable interns to build a strong portfolio of work, showcasing
their skills and accomplishments to potential employers through completed projects and
contributions to open-source initiatives.
By the end of the internship, interns will have gained substantial knowledge and
experience in Python programming, preparing them for successful careers in software
development andrelated fields.
1.2 Reference
https://slashmark.cloud/login1.php
1.3 About the Internship
9
appreciation for Python's versatility and power. With a solid foundation in computer
science, I have honed my skills through coursework and personal projects that emphasize
Python's capabilities in data analysis, web development, and automation. My experience
includes developing efficient scripts to automate repetitive tasks, creating web applications
using frameworks like Django and Flask, and analyzing large datasets with libraries such as
Pandas and NumPy. Additionally, I have a keen interest in machine learning, evidenced by
projects where I implemented algorithms using TensorFlow and Scikit-learn. I am confident
that my problem-solving abilities, combined with my enthusiasm for continuous learning and
collaboration, make me a valuable addition to your team. Iam excited about the opportunity to
contribute to real-world projects and grow professionally under the guidance of experienced
mentors at your company.
10
CHAPTER-2
INTRODUCTION
2.1 History
Python is a widely used programming language today. Starting from the first semester
students to final year projects to industry personnel, Python finds its use in developing
programs for graphics applications, text processing, data analysis, among others.
Python was developed by Guido van Rossam, a Dutch programmer, and released in
1991. The nameis inspired from a BBC comedy show Monty Python’s Flying Circus. Python
is a successor of the ABC programming language. At the time of this writing, Python 3 is the
latest major release of Python (on your computers, you may notice the program python3).
Since the last 20 years, Python has been in the Top 10 most popular programming
languages. At the time of this writing (July 2022), Python is the most popular language,
surpassing C and Java (according to the TIOBE index).
2.2 Features
Python is a general-purpose programming language and supports multiple paradigms or
ways of programming. For instance, we can write procedural (sequence of steps) as well as
object-oriented programs (entities as objects and communication using messages across them)
in it. It can also be used to write functional programs (applying and composing functions),
among others. Unlike C and C++, Python is interpreted. This means Python programs are not
compiled and stored into a binary code file (e.g., an executable)., but its source is translated
into machine code and executed by the interpreter directly(without us seeing the executable
code). Thus, on your computers, python3 is an interpreter (and gcc is a compiler for C
programs).
11
Python is also dynamically-typed. This means that the type of a variable may not be
specified in the source code, and is identified when the program executes. Python also relies on
garbage collection which reclaims the allocated memory of the variables which are no longer
needed (referenced, to be precise). This relieves the programmer of the task of memory
deallocation, similar to Java. Python also has a large variety of standard libraries, which allow
us to write complex codes quickly, improving our productivity.
2.3 Installation and Execution
If you have access to the internet, you can write and execute Python programs online
(e.g., Replit, Code Academy, Codevny). If you wish to install it on your laptop or iPad, you
can download the appropriate installable for Windows or Linux or iPadOS or other operating
systems from Python’s official website www.python.org.
For instance, the following screenshot shows a Linux installation and running of Python.
12
Once installed, you can invoke the Python interpreter (using graphical user interface or via a
commandline) to execute a Python program. Python programs can be written in your favorite
editor (e.g., VS Code or Sublime or gedit or even notepad) apart from the Python IDE, called
IDLE on Windows.
On the command line, you can use certain basic commands to navigate through the file
system. Forinstance, if your home directory is /home/user, you can create a directory for
Python programs as:
$ cd # go to home directory
$ mkdir python # create directory
$ cd python # go into that directory
$ cat >hello.py# create a new file hello.pyprint(“Hello World!”)
$ python3 hello.py # run the Python interpreter
Python programs are stored in files typically with extension .py (e.g., hello.py). On a
command-line, wecan execute the program as below.
$ python3 hello.py
A typical first program in a programming language prints Hello World! to the screen.
Below is our firstprogram in Python.
print(”Hello World!”)
The program uses a function print() to output a message to the screen. The message is
given as an argument to print() and is specified in double-quotes (“). It can also be specified in
13
single-quotes (‘) or triple-quotes (‘’’ or “””). When executed using the interpreter, it outputs
the message.
$ python3
hello.pyHello
World!
The last $ indicates that the command-prompt is displayed again for the next command.
2.5 Input and Output
The function print() is used for output, while the function input() is used for taking input
from the user.
Consider the following functionality where we wish to take the user’s name as input and
greet the user.
$ python3
greet.py What is
your name?Guido
van Rossam
Hello Guido van Rossam
One problem here is that we would like to greet exactly the name that was entered. This
demands usto store the name during input and retrieve it during the output. Such an entity
is called a variable. A variable is capable of storing a value which can be retrieved later. In
fact, a variable can hold different values at different times. Our program achieving the above
functionality looks like this.
Example: A card is drawn at random from a deck of well-shuffled cards. Find the probability
of it being neither a king nor a spade.
14
ncards =
int(52)
nkings =
int(4)
nspades =
int(13)
nspadeki
ng =
int(1)
nnonspadenonking = ncards - (nkings + nspades -
nspadeking)probnonspadenonking = nnonspadenonking /
ncards print('Probability of nonking, nonspade is',
probnonspadenonking)
We can restrict the output to a few decimal digits using format specification (similar to C).
2.7 Strings
String is a fundamental data type in Python and the language provides many ways of
manipulating strings. Strings are enclosed in single-, double-, or triple-quotes. Triple-quoted
strings can span multiple lines. Certain characters such as ‘\n’ have special meaning and are
not treated as two characters, but one. These are called escape characters or escape sequences.
Strings can be concatenated readily by using the + operator. Note that concatenation does not
add a space between the two strings.
Consider an institute with roll numbers of the following format. An example rollnumber is
CS23B010.
Our task is to extract these different fields from an input roll number. The solution program
is given below:
15
rollno = input() # CS23B010
branch = rollno[0:2] # CS
year = int(rollno[2:4]) # 23
degree = rollno[4] #B
position = int(rollno[5:8]) # 010
16
CHAPTER-3
CONTROL STRUCTURES
3.1 Conditions
The duplication can be avoided if we can combine the if conditions on Lines 2 and 3.
Python allows usto do that using conjuncts such as and and or.
The conjunct executes the if-block if both the conditions are true. Otherwise, it executes the
else-block.Line 2 can also be written succinctly as:.
if rollNum[0:2] == 'CS':
Example: Find the student from your department where the roll number may be in capital or
small-caseletters.
Are the last two programs equivalent? The answer is no. The last program allows roll numbers
‘CS…’and‘cs…’, but does not allow a mixed-case ‘Cs…’ or ‘cS…’, which is permitted by the
earlier program.
17
3.2 Loops
Some programs cannot be written without the ability to repeat. For instance, consider
printing ‘Hello World!’ 100 times. One can write 100 print() statements easily. However, if I
now ask you to write a program to take a number from the user and print ‘Hello World!’ those
many times, you would be stuck!
Loops allow us to repeat an arbitrary piece of code, arbitrarily number of times. Python
supports two types of loops: while and for. The while loop iterates through (repeats) a sequence
of code till a given condition is True. The for loop iterates over the items of a givensequence.
Wewill study both in detail now.
While Loop
Let’s first write our program to print a message a certain user-defined number of times.
1. n =
int(input())
2.i = 0
3. while i < n:
4. print('Hello World!')
Note the similarity of the loop’s structure with that of an if statement. The body of the loop
(in this case,Line 4) is repeated till the condition on Line 3 is true.
If you enter 10 as input, how many ‘Hello World!’s does our program print? 9 or 10? Well, it
continues to print ‘Hello World!’ an unbounded number of times. Why? Because we asked it
to. The condition i < n continues to remain true, as the value of i never changes in the loop. To
get the expected result, we need toincrement i.
1. n = int(input())
2. i = 0
3. while i < n:
4. print('Hello World!')
5. i=i+1 # progress
18
CHAPTER-4
FUNCTIONS, MODULES, PACKAGES
Functions
Functions allow us to separate a specific functionality and reuse it from multiple places.
For instance, we use the functions print and len() which are defined in the standard Python
library. But we can write our own functions too!
Let’s begin with defining a function for printing a message and calling it in different ways.
Modules
Modules are what we have been writing so far. Each program we have created is a module,
just that wedid not look at them that way. Typically, a module is a collection of cohesive
functions. For instance, while designing a large application, we may want to keep all the
functions related to data base processing, frontend, error handling, utilities in different
modules. Let’s recall our prime number program. Say, we have stored it in a file primefun.py.
19
Packages
A package encapsulates multiple modules of a project. From a data organization
perspective, a module is stored in a .py file, while a package is the directory containing the .py.
We can then access a module mod in package pack as pack.mod. In general, a module file
may not be directly inside a package directory, but may be nested deeper, due to multiple
subdirectories – for instance, pack.subdir1.subdir2.mod. In such cases, each of subdir1, subdir2
etc. are called subpackages.
Let’s consider a concrete example of a project. Say, we wish to implement a simple game –
tic-tac-toe.A sample is shown below. In a 3x3 grid, two players fill in two symbols (say, X and
O) in empty cells alternatively.
While our code needs to use the fully qualified path package.subpack1.subpack2.variable,
we can use shorthand idea to reduce the typing. For instance:
The game can be nicely implemented as a package, since it has multiple components. We
need to have the game logic in one module, and game display in another. We can add more
functionality such as storing.The over all directory structure looks like.
tictactoe/ # package
import tictactoe
print("in ttt")
tictactoe.loadGame("text") # argument decides whether to load the game in text or GUI.
We learned various ways to group statements using functions, functions using modules, and
modules using packages. In the process, we developed slightly larger codes which allow us to
develop applications.
21
CHAPTER-5
FILES AND REGULAR EXPRESSION
A file is opened for processing in Line 1 (the operating system sets up resources
using which thefile can be accessed), processed (Line 3), and closed in Line 6 (allowing the
operating system to release theresources).
5.2 Text Processing
Python is well-suited for processing text data, among other aspects. First, string is a basic
type supported. Second, there are several functions provided for filtering and manipulating
strings. We will explore many of these functions via developing an application’s backend.
Example: Process conference registration data.
Consider that you have developed a web-form (say, using Google Forms) which collects
information of registrants and stores it in a spreadsheet. The basic information supplied is
name, email, phone, affiliation, and designation, and the form also captures the time of
registration.
There are libraries which support processing of spreadsheets. In our application, we can
convert it into a text-based .csv (comma-separated values) file, so that it can be processed as a
tabular data.
22
5.3 Pattern Matching and Regular Expressions
Sometimes, an exact match cannot be specified to cover all the cases. Consider, for
instance, finding a mobile number from a text. One may find it easy to go over the text and
identify ten consecutive digits. This is alright, but sometimes the mobile number is written in
different forms, such as 99406 67821 (with a space or a hyphen), while at times as (994) 066-
7821 (e.g., in the US). One can write a program to identify all such patterns. Regular
expressions allow us to specifythose patterns succinctly.
Python provides a module re for regular expressions. We will start with a function findall()
to identify all occurrences of a given pattern in a text.
Example: Find all the mobile numbers out of a long text.We will first show the program and
then explain.
1. import re
2.
3.
text = """
4.
Hello, I am Dr. Mobile123. Please call me in case of an emergency. My phone number is
99405 33241. Otherwise, you can call my assistant at 8932732436. I am available at my
clinic from 9 to 1. For appointments, call the reception at (687) 324-3232.
"""
5.
6.
7.
8. digits10 = r'\d{10}' # 10 consecutive digits#
9. digits55 = r'\d{5}\D\d{5}' 5 digits gap 5 digits
10. digitsus = r'\(\d{3}\)\s?\d{3}\D\d{4}' # (3 digits) 3 digits - 4 digits
11. regex = digits10 + '|' + digits55 + '|' + digitsus # first or second or third pattern
12. mobiles = re.findall(regex, text)
13. print(mobiles)
23
The output of the above program is:
By now, we know how to convert this data into a .csv file and read the records in various
lists. Note that all the authors are part of the same column. Since author names can be
ambiguousor written differently in different documents (e.g., R. Nasre or Rupesh Nasre),
Scopus maintains a unique ID per author, which is given in the second column. We would like
to query this information. All the code along with sample data is available on the course
webpage2. We note that there is a difference in the way Windows and Linux store newline
characters in files. Therefore, your program may not directly work across the platforms. To
ease out your processing, the course webpage lists files in both ‘dos’ (for Windows) and ‘unix’
(for Linux) formats. Also, to handle special characters in Windows, one may need to change the
encodingto UTF-8 as follows.
df = open(datafile, encoding=’utf8’)
24
CHAPTER-6
DJANGO FRAMEWORK
6.1 Installing and Running Django
If Django is not already installed, it can be readily installed with the usual commands. For
instance, on Linux, the following command can be used.
sudo apt install python3-django
On Windows, it is a two step process. In the first, we create a virtual environment, and then we
can install Django via pip installer, as follows. All these commands can be executed either in
cmd command prompt in Windows or in its PowerShell.
Here, my django is a project name of your choice. If the command runs successfully, it would
not show any output, but will create the following directory structure.
For now, ignore the use of various files and subdirectories. We will get back to them as we
create our first web application. But these files should indicate that Django is installed
properly. We can now startthe server.
$ ls -R mydjango/
mydjango/:
db.sqlite3 manage.py mydjango
mydjango/mydjango:
asgi.py init .py pycache settings.py urls.py wsgi.py
mydjango/mydjango/ pycache :
init .cpython-38.pyc settings.cpython-38.pyc urls.cpython-38.pyc wsgi.cpython-38.pyc
For now, ignore the use of various files and subdirectories. We will get back to them as we
create our first web application. But these files should indicate that Django is installed
properly. We can now start the server.
25
6.2 Creating and Running a Web Application
We are now ready to create our first web application. Navigate to the my django directory
(where
manage.py exists) and issue the following command.
This is our first web application, named app one. You will see the corresponding directory
created in the current directory, with the following structure.
$ ls -R
Let’s see if this is sufficient to run our webapp app one. We restart the server.
$ python3 manage.py run server
Let’s see if this is sufficient to run our webapp app one. We restart the server.
and in our web-browser, we enter the same url: http://127.0.0.1:8000/
This works as before (with the rocket sign). This means we have not broken anything (so far).
Now we check app one by entering the url in the browser as: http://127.0.0.1:8000/appone
This shows the browser screen as below.
26
6.3 Parameter Passing with GET
http://127.0.0.1:8000/expo/?x=2&y=8
Users can pass parameters to our web-app. For instance, we can write an app for
exponentiation (it is an overkill, but this is an example). One can then invoke the program
as:
1. def index(request):
2. x = int(request.GET['x'])
3. y = int(request.GET['y'])
4. return HttpResponse(str(x**y))
The parameters are named, are assigned values using = operator, and are separated by &.
Inexpo/views.py, we can then extract the values of x and y, compute x**y and print the value in
the HTTP response. Django provides a dictionary GET within its HTTP reques tto access the
sevariables.
256
You can experiment with other values. Let’s make use of such parameter passingfunctionality
to create our Django webpage.
Sample screenshots of our personal webpage are shown below. The first screen shows the
landing Home page.
27
Note the URL in the address bar. The next page is about Projects.
28
CHAPTER-7
CONCLUSION
I conclude that, this internship has been a very useful experience for me. I can safely say
that my understanding of the job environment has increased greatly. However, I do think that
there are some aspects of the job that I could have done better and that I need to work on. I
need to build more confidence in applying accounting principles realized that I could have
completed the work earlier than I did. Also, the technical parts of the job were a bit flawed and
I was asked multiple times to correct it.
The two main things that I learned after my experience in this firm are the importance of
time management and being self-motivated.
29
CHAPTER-8
INTERNSHIP OUTCOMES
This internship provides a student with paid professional work experience in a safe and
structured environment with help from experts. Typically, an intern will be assigned a worksite
mentor and school- based internship coordinator. The worksite mentor will help train a student
and advise him or her on how to navigate a particular worksite culture and interact with other
workers. The school internship coordinator helps the mentor and student build a strong
relationship that will help the intern have positive outcomes from their internship experience.
The internship coordinator can also help the student learn how to manage their expectations
and implement successful work habits.
Internships help students master professional soft skills such as communication, punctuality.
Internships help students master professional soft skills such as communication, punctuality
and time management. These are skills that are key for success at a job and college and are
highly sought after by companies. Many employers complain that there are few candidates
with excellent soft skills. At an internship, a student can practice and improve their industry
skills while also learning how to work. Students can gain a better understanding of how what
they are learning in school can help them with their future.
30
CHAPTER-9
CRITERIA FOR CERTIFICATION
This internship certificate is very important for every undergraduate students who is
pursing degree like B-Tech or any other. It is also important for the students of postgraduation.
This certificate will gives the best value and weightage for our resume. This internship
certificate plays an vital role in our life .
On the off chance that you are interested about work fields and want more experience in
field without having to go digging into its academic aspects, opting for an internship to get
better understanding about the subject and get closer to the your goals. Internships are
programs for students who’ve completed their graduation that give you more work experience
and last for a short duration of time. Almost all courses that are taught professionally offer
internship programs so the students can get a better sense of the subject and more knowledge
about its technicalities before they choose to pursue courses like BBA, B-Tech and MBA.
Having the biggest organizations and managements offering rewarding chances for training
to promising experts of each field, internships have become quite popular among students
getting their Bachelor’s Degree. With an increasing demand in work experience when students
go in for job interviews, internships provide you with a certificate which shows your
experience in that particular field and is proved to be beneficial in getting a job. Mentioned
below are some advantages of getting additional internship certificates and the effect they have
in boosting your career.
31
INTERNSHIP CERTIFICATE
32
+
Internship Diary