0% found this document useful (0 votes)
3 views31 pages

Python Full Stack Document

Uploaded by

vinothkumare561
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views31 pages

Python Full Stack Document

Uploaded by

vinothkumare561
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

PYTHON FULL STACK DOCUMENT

BACKEND:

PYTHON OVERVIEW

Python is a high-level, interpreted, interactive and object-oriented


scripting language. Python is designed to be highly readable. It uses
English keywords frequently whereas other languages use
punctuation, and it has fewer syntactic constructions than other
languages.

 Python is Interpreted: Python is processed at runtime by the


interpreter. You do not need to compile your program before
executing it. This is similar to PERL and PHP.
 Python is Interactive: You can actually sit at a Python prompt and
interact with the interpreter directly to write your programs.
 Python is Object-Oriented: Python supports Object-Oriented
style or technique of programming that encapsulates code within
objects.
 Python is a Beginner's Language: Python is a great language for
the beginner-level programmers and supports the development of a
wide range of applications from simple text processing to WWW
browsers to games.

History of Python
Python was developed by Guido van Rossum in the late eighties and
early nineties at the National Research Institute for Mathematics and
Computer Science in the Netherlands.

Python is derived from many other languages, including ABC,


Modula-3, C, C++, Algol-68, SmallTalk, Unix shell, and other
scripting languages.

Python is copyrighted. Like Perl, Python source code is now available


under the GNU General Public License (GPL).

Python is now maintained by a core development team at the institute,


although Guido van Rossum still holds a vital role in directing its
progress.

Python Features

Python's features include:

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 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 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 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.

Apart from the above-mentioned features, Python has a big list of


good features, few are listed below:

 IT supports functional and structured programming methods as


well as OOP.
 It can be used as a scripting language or can be compiled to byte-
code for building large applications.
 It provides very high-level dynamic data types and supports
dynamic type checking.
 IT supports automatic garbage collection.
 It can be easily integrated with C, C++, COM, ActiveX, CORBA,
and Java.

Python is available on a wide variety of platforms including Linux


and Mac OS X. Let's understand how to set up our Python
environment.

LANGUAGE USED:

1.What is Python:
Python is an object-oriented, high level language, interpreted,
dynamic and multipurpose programming language.
Python is easy to learn yet powerful and versatile scripting language
which makes it attractive for Application Development.
Python's syntax and dynamic typing with its interpreted nature, make
it an ideal language for scripting and rapid application development in
many areas.
Python supports multiple programming pattern, including object
oriented programming, imperative and functional programming or
procedural styles.
Python is not intended to work on special area such as web
programming. That is why it is known as multipurpose because it can
be used with web, enterprise, 3D CAD etc.
We don't need to use data types to declare variable because it
is dynamically typed so we can write a=10 to declare an integer value
in a variable.
Python makes the development and debugging fast because there is
no compilation step included in python development and edit-test-
debug cycle is very fast.
2. Python Features
1) Easy to Use:
Python is easy to very easy to use and high level language. Thus it is
programmer-friendly language.

2) Expressive Language:
Python language is more expressive. The sense of expressive is the
code is easily understandable.
3) Interpreted Language:
Python is an interpreted language i.e. interpreter executes the code
line by line at a time. This makes debugging easy and thus suitable for
beginners.

4) Cross-platform language:
Python can run equally on different platforms such as Windows,
Linux, Unix , Macintosh etc. Thus, Python is a portable language.

5) Free and Open Source:


Python language is freely available(www.python.org).The source-
code is also available. Therefore it is open source.

6) Object-Oriented language:
Python supports object oriented language. Concept of classes and
objects comes into existence.

7) Extensible:
It implies that other languages such as C/C++ can be used to compile
the code and thus it can be used further in your python code.

8) Large Standard Library:


Python has a large and broad library.

9) GUI Programming:
Graphical user interfaces can be developed using Python.

10) Integrated:
It can be easily integrated with languages like C, C++, JAVA etc.

3. Python History

 Python laid its foundation in the late 1980s.


 The implementation of Python was started in the December
1989 by Guido Van Rossum at CWI in Netherland.
 ABC programming language is said to be the predecessor of
Python language which was capable of Exception Handling and
interfacing with Amoeba Operating System.
 Python is influenced by programming languages like:
 ABC language.
 Modula-3

4. Python Version
Python programming language is being updated regularly with new
features and support. There are a lot of updation in python versions,
started from 1994 to current date.
A list of python versions with its released date is given below.
Python Version Released Date

Python 1.0 January 1994

Python 1.5 December 31, 1997

Python 1.6 September 5, 2000

Python 2.0 October 16, 2000

Python 2.1 April 17, 2001

Python 2.2 December 21, 2001

Python 2.3 July 29, 2003

Python 2.4 November 30, 2004

Python 2.5 September 19, 2006

Python 2.6 October 1, 2008

Python 2.7 July 3, 2010

Python 3.0 December 3, 2008

Python 3.1 June 27, 2009

Python 3.2 February 20, 2011

Python 3.3 September 29, 2012

5. Python Applications
Python as a whole can be used in any sphere of development.
Let us see what are the major regions where Python proves to be
handy.
1) Console Based Application
Python can be used to develop console based applications. For
example: IPython.
2) Audio or Video based Applications
Python proves handy in multimedia section. Some of real applications
are: TimPlayer, cplay etc.
3) 3D CAD Applications
Fandango is a real application which provides full features of CAD.

4) Web Applications
Python can also be used to develop web based application. Some
important developments are: PythonWikiEngines, Pocoo,
PythonBlogSoftware etc.

5) Enterprise Applications
Python can be used to create applications which can be used within an
Enterprise or an Organization. Some real time applications are:
OpenErp, Tryton, Picalo etc.

6) Applications for Images


Using Python several application can be developed for image.
Applications developed are: VPython, Gogh, imgSeek etc.
There are several such applications which can be developed using
Python
6. Python Example
Python code is simple and easy to run. Here is a simple Python code
that will print "Welcome to Python".
A simple python example is given below.
1. >>> a="Welcome To Python"
2. >>> print a
3. Welcome To Python
4. >>>

Explanation:

 Here we are using IDLE to write the Python code. Detail


explanation to run code is given in Execute Python section.
 A variable is defined named "a" which holds "Welcome To
Python".
 "print" statement is used to print the content. Therefore "print a"
statement will print the content of the variable. Therefore, the
output "Welcome To Python" is produced.

Python 3.4 Example


In python 3.4 version, you need to add parenthesis () in a string code
to print it.

1. >>> a=("Welcome To Python Example")


2. >>> print a
3. Welcome To Python Example
4. >>>

7. How to execute python


There are three different ways of working in Python:
1) Interactive Mode:
You can enter python in the command prompt and start working with
Python.

Press Enter key and the Command Prompt will appear like:
Now you can execute your Python commands.
Eg:

2) Script Mode:
Using Script Mode , you can write your Python code in a separate file
using any editor of your Operating System.
Save it by .py extension.

Now open Command prompt and execute it by :


NOTE: Path in the command prompt should be where you have saved
your file. In the above case file should be saved at desktop.

3) Using IDE: (Integrated Development Environment)


You can execute your Python code using a Graphical User Interface
(GUI).
All you need to do is:
Click on Start button -> All Programs -> Python -> IDLE(Python
GUI)
You can use both Interactive as well as Script mode in IDE.
1) Using Interactive mode:
Execute your Python code on the Python prompt and it will display
result simultaneously.
2) Using Script Mode:
i) Click on Start button -> All Programs -> Python -> IDLE(Python
GUI)
ii) Python Shell will be opened. Now click on File -> New Window.
A new Editor will be opened . Write your Python code here.

Click on file -> save as


Run then code by clicking on Run in the Menu bar.
Run -> Run Module
Result will be displayed on a new Python shell as:
8. Python Variables
Variable is a name of the memory location where data is stored. Once
a variable is stored that means a space is allocated in memory.
Assigning values to Variable:
We need not to declare explicitly variable in Python. When we assign
any value to the variable that variable is declared automatically.
The assignment is done using the equal (=) operator.
Eg:

Output:

1. >>>
2. 10
3. ravi
4. 20000.67
5. >>>
Multiple Assignment:
Multiple assignment can be done in Python at a time.
There are two ways to assign values in Python:
1. Assigning single value to multiple variables:
Eg:

1. x=y=z=50
2. print x
3. print y
4. print z

Output:

1. >>>
2. 50
3. 50
4. 50
5. >>>

2.Assigning multiple values to multiple variables:


Eg:

1. a,b,c=5,10,15
2. print a
3. print b
4. print c

Output:
1. >>>
2. 5
3. 10
4. 15
5. >>>

The values will be assigned in the order in which variables appears.


Basic Fundamentals:
This section contains the basic fundamentals of Python like :
i)Tokens and their types.
ii) Comments
a)Tokens:

 Tokens can be defined as a punctuator mark, reserved words and


each individual word in a statement.
 Token is the smallest unit inside the given program.

There are following tokens in Python:

 Keywords.
 Identifiers.
 Literals.
 Operators.

Tuples:

 Tuple is another form of collection where different type of data


can be stored.
 It is similar to list where data is separated by commas. Only the
difference is that list uses square bracket and tuple uses
parenthesis.
 Tuples are enclosed in parenthesis and cannot be changed.

Eg:

1. >>> tuple=('rahul',100,60.4,'deepak')
2. >>> tuple1=('sanjay',10)
3. >>> tuple
4. ('rahul', 100, 60.4, 'deepak')
5. >>> tuple[2:]
6. (60.4, 'deepak')
7. >>> tuple1[0]
8. 'sanjay'
9. >>> tuple+tuple1
10. ('rahul', 100, 60.4, 'deepak', 'sanjay', 10)
11. >>>

Dictionary:

 Dictionary is a collection which works on a key-value pair.


 It works like an associated array where no two keys can be
same.
 Dictionaries are enclosed by curly braces ({}) and values can be
retrieved by square bracket([]).Eg:

1. >>> dictionary={'name':'charlie','id':100,'dept':'it'}
2. >>> dictionary
3. {'dept': 'it', 'name': 'charlie', 'id': 100}
4. >>> dictionary.keys()
5. ['dept', 'name', 'id']
6. >>> dictionary.values()
7. ['it', 'charlie', 100]
8. >>>
9. Python Keywords
10.

True False None And as

Asset Def class Continu break


e

Else Finally elif Del except

Global For if From import

Raise Try or Return pass

Nonloca In not Is lambda


l

11. Keywords are special reserved words which convey a


special meaning to the compiler/interpreter. Each keyword have
a special meaning and a specific operation. List of Keywords
used in Python are:
10. Identifiers
Identifiers are the names given to the fundamental building blocks in
a program.
These can be variables ,class ,object ,functions , lists , dictionaries etc.
There are certain rules defined for naming i.e., Identifiers.
I. An identifier is a long sequence of characters and numbers.
II.No special character except underscore ( _ ) can be used as an
identifier.
III.Keyword should not be used as an identifier name.
IV.Python is case sensitive. So using case is significant.
V.First character of an identifier can be character, underscore ( _ )
but not digit.

Common SQL Commands:

Databases – Storing and Managing Data


A database is an organized collection of data that can be easily
accessed, managed, and updated. In web development, databases are
used to store user data, login information, product details,
transactions, and more.

Types of Databases
 Relational Databases (SQL)

 Stores data in tables (rows and columns).


 Examples: MySQL, PostgreSQL, SQLite, Oracle

 Uses SQL (Structured Query Language) for queries.

 Non-Relational Databases (NoSQL)

-- Create a table
CREATE TABLE users (
id INTEGER PRIMARY KEY,
name TEXT,
email TEXT
);

-- Insert data
INSERT INTO users (name, email) VALUES ('Alice',
'[email protected]');

-- Select data
SELECT * FROM users;

-- Update data
UPDATE users SET name = 'Bob' WHERE id = 1;

-- Delete data
DELETE FROM users WHERE id = 1;

FRONT END CONTENT:

1. HTML – HyperText Markup Language


HTML is the backbone of any web page, used to define the structure
and content. It uses a system of tags and elements to display text,
images, links, and other content.

Basic Syntax Example:


<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a simple HTML paragraph.</p>
</body>
</html>
Key Tags: <html>, <head>, <body>, <h1>-<h6>, <p>, <a>, <img>,
<div>

🔹 2. CSS – Cascading Style Sheets


CSS is used to style HTML content, such as fonts, colors, spacing,
and layouts. CSS can be written inside the HTML file or in an
external .css file.

Basic Example:

<style>
body {
background-color: #f0f0f0;
font-family: Arial;
}
h1 {
color: darkblue;
}
</style>
Types of CSS:

Inline CSS (inside HTML tag)

Internal CSS (<style> inside <head>)

External CSS (linked via <link rel="stylesheet">)

🔹 3. JavaScript – Web Interactivity


JavaScript is a client-side scripting language used to make websites
interactive, dynamic, and functional.

Basic Example:
<script>
function showMessage() {
alert("Hello from JavaScript!");
}
</script>
<button onclick="showMessage()">Click Me</button>
Common Uses:

Form validation

DOM manipulation

API calls (AJAX/fetch)

Animations

🔹 4. Flask – Python Web Framework


Flask is a lightweight, micro web framework written in Python. It is
ideal for small to medium web applications and APIs.

Key Features:
 Simple and flexible

 Built-in development server

 Easy integration with databases

Basic Flask App:

from flask import Flask

app = Flask(__name__)

@app.route('/')
def home():
return "Welcome to my Flask App!"

if __name__ == '__main__':
app.run(debug=True)
You can return HTML using render_template() function from Flask.

Applications of Python Full Stack Development


Python Full Stack Development refers to building complete web
applications using Python for the backend (like Flask or Django) and
HTML, CSS, JavaScript for the frontend, along with a database (like
SQL). A full stack developer is capable of handling both client-side
and server-side components of a web application.

Below are the major applications and use cases of Python Full Stack
development:

1️ Web Applications
Create responsive and interactive websites.
Handle both frontend (UI) and backend (data processing).
Use frameworks like Flask or Django for robust backend
functionality.
Example: E-commerce websites, blogs, school portals.

2️ RESTful APIs
Build REST APIs to serve data to frontend apps or mobile
applications.
Use Flask-RESTful or FastAPI to expose endpoints for CRUD
operations.
Example: Backend API for a food delivery or weather app.

3️ Content Management Systems (CMS)


Full stack apps can manage and publish content dynamically.
Python backend stores content in databases, and frontend displays it
with templates.
Example: Custom CMS for blogs, news, and documentation.
4️Dashboard & Admin Panels
Build data dashboards with charts and graphs using libraries like
Chart.js, Plotly, and Flask.
Use SQL queries to fetch data and JS/CSS to display them
attractively.
Example: Sales dashboards, HR panels, IoT monitoring systems.

5️ E-commerce Platforms
Python full stack supports online shopping systems with product
listing, cart, checkout, and payment gateway integration.
Secure login, inventory management, and order tracking can be built
easily.
Example: Online bookstore or clothing store.

6️Authentication Systems
Handle user registration, login/logout, and role-based access securely.
Use Python libraries like Flask-Login, JWT, or OAuth2.
Example: Student portals or admin-only systems.

7️ Machine Learning Web Apps


Deploy ML models on the web using Flask + HTML/CSS/JS.
Users input data in forms and get predictions from Python backend.
Example: Fake news detection app, loan approval predictor.
8️ Chat Applications
Create real-time chat apps using Flask-SocketIO and frontend JS.
Store messages in a database and display them live.
Example: Simple chat system for teams or schools.

9️ Job Portals
Users can register, apply for jobs, and view job listings. Admins can
post and manage job openings using backend dashboard.
Example: Job board for college placements.

10 Portfolio or Resume Websites


Python full stack is ideal for building a personal site with projects,
skills, and contact forms. Can integrate a database to store visitor
feedback or inquiries.
Example: Interactive resume with downloadable projects.

You might also like