Python Full Stack Development Summer Internship Report
Python Full Stack Development Summer Internship Report
1. INTRODUCTION TO PYTHON
1.1 INTRODUCTION
Python is a simple, general purpose, high level, and object-oriented programming
language.
Python is a interpreted scripting language.
Python is a trending programming language to develop various applications.
As of 2022, Python continues to be one of the most popular programming languages
worldwide, used extensively in Web development, data science, machine learning,
artificial intelligence, science computing, automation, and more.
The Python Software Foundation (PSF) oversees Python’s development and promotes
its adoption and growth.
1.2 HISTORY
Invented in Netherlands early by Guido Van Rossum.
Python was conceived in late 1980’s and its implementation was started in December
1989.
Guido van Rossum is fan of ‘Monty Python Firing Circus,’ this is a famous TV show in
Netherlands.
Maned after Monty Python.
Open sourced in the year 2012.
Its vibrant community and thriving ecosystem ensure that Python remains relevant and
continues to evolve to meet the needs of developers and industries alike.
1.3 FEATURES
Easy-to-learn – Python has few keywords, simple structures, 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 eyes.
Easy-to-maintain – Python’s source code is fairly easy-to-maintain.
A broad standard library – Python’s bulk pf the library is very portable and cross-
platform 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 widely variety of hardware platforms and has the same
interface on all platforms.
Extendable – It can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more 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 system of Unix.
Scalable – Python provides a better structure and support for large programs than shell
scripting.
1.4 APPLICATIONS
Web Development
Django – A high-level Python web framework that enables rapid development and
clean, pragmatic design.
Flask – A lightweight web framework that provides the essentials for building web
applications without the complexity of a full-stack framework.
Pyramids – A flexible and minimalist web framework for building small to large-
scale web applications.
Data Science and Analytics
NumPy – A library for numerical computing that provides support for large, multi-
dimensional arrays and matrices.
Pandas – A library for data manipulation and analysis, offering data structures and
functions to efficiently work with structured data.
Matplotlib – A plotting library for creating ststic, interactive, and animated
visualizations in Python.
Scikit-learn – A machine learning library that provides simple and efficient tools for
data mining and analysis.
Start Using: Access Python via command line with ‘python,’ or create and run Python
scripts.
10
The hardware and software requirement for Python development and execution are
relatively minimal, making it accessible across a wide range of devices and platforms.
HARDWARE REQUIREMENT
(a) (b)
(c)
Fig 2. Hardware Requirements of Python (a) i3 processor (b) RAM (c) Storage.
11
SOFTWARE REQUIREMENT
Operating System
Python is compatible with various operating systems, including Windows,
Macintosh, Linux distributions (e.g., Ubuntu, Debian, CentOS).
Python code written on one operating system can typically run on other without
modification, thanks to Python’s cross-platform compatibility.
Python Interpreter
You need a Python interpreter to run Python code. You can download and install the
official Python interpreter from the Python Software Foundation's website: Python
Downloads.
Integrated Development Environment (IDE)
While not strictly required, using an IDE or text editor can greatly enhance your
Python development experience. Some popular choices include: PyCharm, Visual
Studio Code (with Python extension), Sublime Text, Atom, Vim, Emacs are shown in
Fig 3.
Package Manager
Python's package manager, pip, comes bundled with Python installations starting
from Python 3.4.
Optional: Virtual Environments
While not mandatory, using virtual environments (‘virtualenv’ or ‘venv’) is
considered a best practice for managing dependencies. You can create virtual
environments to isolate your Python projects and their dependencies, ensuring
consistency and avoiding conflicts between different projects.
Optional: Dependency Management Tools
Depending on your project's requirements, you may need additional tools for
managing dependencies, such as:
requirements.txt files for specifying project dependencies.
Python's minimal hardware and software requirements contribute to its popularity and
accessibility, allowing developers to write and run Python code on a wide range of devices
and platforms with ease.
12
13
COMPILATION
The program is converted into byte code. It can run on any operating system and hardware.
The byte code instructions are created in the .pyc file.
INTERPRETER
The next step involves converting the byte code (.pyc code) into machine code. This step is
necessary as the computer can understand only machine code (binary code). Python Virtual
Machine (PVM) first understands the operating system and processor in the computer and
then it converts it into machine code. These machine code instructions are executed by
processor and the results are displayed as in Figure 4.
2. KEY CONCEPTS
1) Numbers
2) Strings
NUMBERS
14
Commas are never used in numeric literals 10,20,30,40 are not allowed in python.
There is no limit to size of an integer.
Floating point numbers do not have limited range and limited precision.
Range – 10^-308 to 10^308
Precision – 10to 17 digits.
STRINGS
ESCAPE SEQUENCES
15
16
Type () – This function is used to determine the type of an object as in Figure 6. It returns
the type of the object as a class object.
III. BOOLEAN
The Boolean data type is either True or False.
In Python, Boolean variables are defined by the True and False keywords.
IV. COLLECTIONS
Collections refers to data structures that are used to store and manage collections of data.
These collections provide various functions and are designed to suit different needs.
Collections in python are basically container data types, namely lists, sets, tuples, dictionary.
Here an introduction to collections in Python along with some commonly used types:
17
LISTS
TUPLES
Tuples are similar to lists but are immutable, meaning their content cannot be changed
after creation.
Tuples are created using parentheses ‘()’.
Example: ‘my_tuples = (1, 2, 3, 4, 5, 6)’
SETS
DICTIONARIES
2.4 OPERATIONS
In Python, operators are special symbols or keywords that are used to perform
operations on operands. Here is an overview of the different types of operators in Python:
ARITHMETIC OPERATORS
Addition: ‘+’
Subtraction: ‘-’
18
Multiplication: ‘*’
Division: ‘/’
Floor Division: ‘//’ (returns the integer part of the division)
Modulus: ‘%’ (returns the remainder of the division)
Exponentiation: ‘**’ (raises the left operand to the power of the right operand)
COMPARISON OPERATIONS
Comparison operators are used to compare the values of two operands as shown in Figure 8.
Equal to: ‘==’
Not equal to: ‘! =’
Greater than: ‘>’
Less than: ‘<’
Greater than or equal to: ‘>=’
Less than or equal to: ‘<=’
19
LOGICAL OPERATORS
Logical operators are used to combine conditional statements as in Figure 10.
Logical AND – ‘and’
Logical OR – ‘or’
Logical NOT – ‘not’
ASSIGNMENT OPERATORS
Assignment operators are used to assign values to variables as in Figure 11.
Assignment: ‘=’
Addition assignment: ‘+=’
Subtraction assignment: ‘ -=’
Multiplication assignment: ‘*=’
Division assignment: ‘/=’
Modulus assignment: ‘%=’
Floor division assignment: ‘//=’
Exponentiation assignment: ‘**=’
20
BITWISE OPERATION
Bitwise operators are used to perform bitwise operations on integers as in Figure 12.
Bitwise AND: ‘&’
Bitwise OR: ‘|’
Bitwise XOR: ‘^’
Bitwise NOT: ‘ ~’
Left shift: ‘<<’
Right shift: ‘>>’
Type casting and type coercion are both mechanisms used in programming language
to convert data from one type to another, but they differ in their approaches and implications.
Explicit conversion of a value from one datatype to another is called type casting.
Implicit conversion of datatypes during compilation or runtime is called Type
Coercion.
TYPE CONVERSION
Type conversion, also known as type casting, is the process of converting a value from one
data type to another. In Python, it can perform type conversion using built-in functions or
constructors. Here are some common type conversion functions:
21
3. CONTROL STATEMENTS
In Python, control statements are used to control the flow of execution in a program based on
certain conditions. They allow to make decisions, execute code repeatedly, and handle
exceptions. Three fundamental methods of control flow:
1) Sequential
2) Selection (execution only a selected set of stmts)
3) Iteration (execute a set of statements repeatedly)
These statements usually jump from one part of code to another depending on whether a
particular condition is satisfied or not.
Conditional statements execute sequentially when there is no condition around the
statements.
If you put some condition for a block of statements, the execution flow may change based
on the result evaluated by the condition.
22
SAMPLE PROGRAM
If you input a positive number like 5, the program will increment it by 1, resulting in 6 as the
output. If you input a number that is not positive, such as 0 or a negative number, the
program will not increment it, and the output will be the same as the input number.
23
Nested if: Nested if statements mean an if statement inside another is statement. The flow
chart for if statement is shown in Figure 14.
SAMPLE PROGRAM
If the input the year 2024, the program will determine that it is a leap year and print "2024 is
a leap year".
24
If-else: The if-else statement evaluates test expression and will execute the body of if only
when the test condition is True. If the condition is False, the body of else is executed.
Indentation is used to separate the blocks.
ITERATIVE STATEMENTS
WHILE LOOP
In the while loop, test expression is checked first. The body of the loop is entered only if
the test expression evaluates to True. After one iteration, the test expression is checked
again. This process continues until the test expression evaluates to False. The flow chart
of while loop is in the figure 15.
25
The break statements terminate the loop containing it. Control of the program flow to the
statements immediately after the body of the loop. If the break statements is inside a nested
loop (loop inside another loop), the break statement will terminate the innermost loop.
In this example, the while loop continues as long as num is less than 5. Inside the loop, num
is printed, and then it is checked whether num is equal to 3. If the condition is true, the break
statement is executed, and the loop terminates
The continue statement is used to skip the rest of the code inside a loop for the current
iteration only. Loop does not terminate but continues on with the next iteration.
In this example, the while loop continues as long as Num is less than 5. Inside the loop,
Num is incremented by 1. Then, it is checked whether Num is equal to 2. If the condition is
26
true, the continue statement is executed, and the loop skips the remaining code block for
that iteration. Otherwise, the value of Num is printed.
FOR LOOP
For loop is usually known as determinate or definite loop because the programmer knows
exactly how many times the loop will repeat. The number of times loop has to be
executed can be determined mathematically checking logic of the loop. The flow chart of
for loop is shown in figure 16.
Syntax
For loop_control_var in sequence:
Statement 1
Statement 2
27
SAMPLE PROGRAM
Program using for loop to check whether the number is even or odd
Each number from 1 to 10 is printed along with whether it is odd or even. Odd numbers have
a remainder of 1 when divided by 2, while even numbers have a remainder of 0.
NESTED LOOPS
Nested loops in Python refer to using one or more loops inside another loop. This allows you
to iterate over a sequence of elements or perform a certain operation multiple times, with one
loop contained within another loop.
Nested loops are commonly used when dealing with multi-dimensional data structures, such
as lists of lists or matrices, or when you need to perform a repetitive task that involves
multiple levels of iteration.
28
In this example, the outer loop (for i in range (5)) iterates over the rows, and the inner
loop which (for j in range (i + 1)) iterates over the columns for each row. This results in a
pattern where the number of asterisks increases with each row.
4. FUNCTIONS
INTRODUCTION
A function is a block of organised and reusable program code that performs a simple,
specific, and well-defined task.
Func (1) is called to perform a well-defined task. As soon as Func (1) is called, the
program control is passed to first statement in function. All the statements in function are
executed and program control is passed to function following the one that called the
function.
Func (1) calls function named Func (2). Therefore Func (1) is known as calling function.
Func (2) is known as function.
29
30
FUNCTION DEFINITION
Function blocks begin with the keyword def followed by the function name and
parentheses().
Any input parameters or arguments should be placed within these parentheses().
The first statement of a function can be an optional statement – the documentation
string of the function or docstring.
The statement return [expression] exists a function, optionally passing back an
expression the caller. A return statement with no arguments is the same as return
None.
FUNCTION CALL
31
INTRODUCTION
File is a collection of data stored on a secondary storage device like hard disk.
If working in a large software application where they process many data, then it cannot
expect those data to be stored in a variable as the variables are volatile in nature.
Hence when it handles such situations, the role of files will come into the picture.
As files are non-volatile in nature, the data will be stored permanently in a second device
like Hard Disk and using python it can handle the files in applications.
TYPES OF FILES
1) Binary file
2) Text file
BINARY FILE
Most of the files that visible in personal computer system are called binary files.
All binary files follow a specific format. It can open some binary files in the normal text
editor but it cannot read the content present inside the file. That is because all the binary files
will be encoded in the binary format, which can be understood only by a computer or
machine.
For handling such binary files it can need a specific type of software to open it.
32
For Example – it needs Microsoft word software to open .doc binary files. Likewise, it need
a .pdf reader software to open .pdf binary files and it need a photo editor software to read the
image files and so on.
TEXT FILE
Text files do not have any specific encoding and it can be opened in normal text editor itself.
Most importantly there are four types of operations that handled by Python on files:
OPENING A FILE
SYNTAX
File_object = open(file_name,mode)
File_name is the name of the file or the location of the file that want to open.
MODE
The file in the open function syntax will tell Python as what operation that what to do on
a file.
‘r’ – Read Mode : Read mode is used only to read data from the file.
‘w’ – Write Mode : This mode is used when it want to write data into a file or modify it.
Remember write mode overwrites the data present in the file.
‘s’ – Append Mode : Append mode is used to append data to the file. Remember data
will be appended at the end of the file pointer.
33
‘r+’ – Read or Write Mode : This mode is used when it want to write or read the data
from the same file.
‘w+’ – Read or Write Mode : When a file is opened in this mode. If the file has not been
created new file will be created if created it is overwritten.
‘a+’ – Append or Read Mode : This mode is used when it want to read data from the
file or append the data into the same file.
BINARY MODE
‘wb’ – Open a file for write only mode in the binary format.
‘rb’ – Open a file for the read -only mode in the binary format.
‘ab’ – Open a file for appending only mode in the binary format.
‘rb+’- Open a file for read and write only mode in the binary format.
‘ab’ - Open a file for appending and read only mode in the binary format.
READ A FILE
There are three ways in which we can read the files in python
Read([n])
Readline([n])
Readlines()
lineno=int(input(“enter a number”))
fp=open(“hello.txt”,”r”)
cufrentline=1
if(currentline==lineno):
print(line)
break
34
In order to close a file, we must first open a file. In python, we have an in built method
called close() to close the file which is opened.
Whenever you open a file, it is important to close it, especially, with write method.
Because if we don’t call the close function after the write method then whatever data we
have written to a file will not be saved in to the file.
Example
Print(my_file.read())
My_file.close()
WRITE A FILE:
In order to write data into a file, we must open the file in the write mode.
We need to be very careful while writing data in to the file as it overwrites the content
present inside the file that you were writing, and all previous data will be erased.
We have two methods for writing data into a file as shown below.
Write(string)
Writelines(list)
Write()
my_file=open(“C:/Documents/Python/test.txt”, “w”)
my_file.write(“Hello World/n”)
Writelines()
35
My_file=open(“C:/Documents/Python/test.txt”, “a+”)
My_file.write(“Strawberry”)
The above code appends the string ‘strawberry’ at the end of the ‘test.txt’file.
My_file=open(“C:/Documents/Python/test.txt”, “w”)
My_file. Writelines(fruits)
ATTRIBUTES DESCRIPTION
Name Return name of file
Mode Return mode of file
Encoding Return encoding format of file
Closed Return true if file closed else return false
36
6.1 INTRODUCTION
KEY ASPECTS
Data Querying: SQL allows users to retrieve data from databases using queries. Queries
can range from simple requests for specific records to complex operations involving
multiple tables and conditions.
Data Manipulation: SQL provides commands for inserting, updating, and deleting data
within a database. This allows users to modify existing records or add new ones as
needed.
Database Definition: SQL includes commands for defining and managing database
structures such as tables, indexes, views, and stored procedures. These structures help
organize and optimize data storage and access.
Data Control: SQL offers mechanisms for controlling access to databases and managing
user permissions. This ensures that only authorized users can view or modify sensitive
data.
Data Integrity: SQL supports the enforcement of data integrity constraints such as
primary keys, foreign keys, and unique constraints. These constraints help maintain the
consistency and reliability of data within a database.
Transaction Control: SQL provides features for managing database transactions,
allowing users to group multiple database operations into atomic units of work. This
ensures that either all operations within a transaction are completed successfully or none
of them are, maintaining data consistency.
37
Structured Data: This type of data has a predefined data model or is organized in a
tabular format with a clear schema, making it easy to query and analyze. Examples
include data in relational databases or spreadsheets.
Unstructured Data: Unstructured data lacks a predefined data model and is not
organized in a structured manner. Examples include text documents, images, audio files,
and videos. Analysing unstructured data often requires specialized tools and techniques
such as natural language processing (NLP) or computer vision.
Semi-Structured Data: Semi-structured data falls somewhere between structured and
unstructured data. It may have a flexible schema or tags that provide some structure, but it
does not fit neatly into a relational database. Examples include JSON, XML, and log files.
Transactional Data: Transactional data records specific events or transactions, typically
in a structured format. Examples include sales transactions, financial transactions, and log
entries.
Temporal Data: Temporal data includes information related to time, such as timestamps
or time-series data. It is commonly used in applications where the temporal aspect is
important, such as IoT (Internet of Things) devices, financial markets, and weather
forecasting.
38
39
1) Download MySQL Installer: Visit the MySQL website and download the MySQL
Installer for your operating system (Windows, macOS, Linux).
2) Run Installer: Locate the downloaded installer file and double-click it to run the
installer.
3) Choose Installation Type: Select your preferred installation type (e.g., "Developer
Default" for standard development setup) and click "Next".
4) Configure MySQL Server: Set the root password for MySQL Server and choose a port
number for MySQL to listen on.
5) Complete Installation: Wait for the installer to finish installing components and
configuring MySQL Server.
40
EXAMPLE
EXAMPLE
1) SELECT – The SELECT statement in SQL is used to retrieve data from table in a
database.
2) WHERE - The WHERE clause is used to filter rows based on a specified condition. It
allows you to retrieve only the rows that meet the specified criteria
4) SELECTION - a selection query filters rows from a table based on specific conditions
41
6.9 OPERATORS
SQL operators are used to perform operations on data in SQL queries. These are the
basic syntax patterns for using common SQL operators in queries. Keep in mind that the
exact syntax may vary slightly depending on the SQL dialect or database management system
you're using.
ARITHMETIC OPERATORS:
COMPARISON OPERATORS:
42
LOGICAL OPERATORS:
CONCATENATION OPERATOR:
IN OPERATOR:
BETWEEN OPERATOR:
IS NULL OPERATOR:
43
7. CONCLUSION
Python full stack development offers a comprehensive approach to building web applications
using Python for both frontend and backend development. Here is a concise conclusion
highlighting its key aspects:
Python's versatility and simplicity make it an excellent choice for full stack development.
With Python, developers can use the same language across the entire stack, from frontend
to backend, reducing complexity and streamlining development.
For frontend development, Python frameworks like Django and Flask offer powerful tools
for building robust web applications. These frameworks provide features such as routing,
templating, form handling, and authentication, allowing developers to create dynamic and
interactive user interfaces.
On the backend, Python's extensive ecosystem of libraries and frameworks, combined
with its ease of integration with databases and other services, enables developers to build
scalable and efficient server-side applications.
Overall, Python full stack development offers a cohesive and efficient approach to
building modern web applications, leveraging Python's strengths in simplicity, versatility, and
extensive ecosystem of libraries and frameworks. As a result, Python remains a popular and
widely-used technology stack for developers seeking to build robust and scalable web
applications.
44
8. WEEK-WISE REPORT
45
46
47
48