You are on page 1of 34

INDUSTRIAL TRAINING REPORT

ON
PYTHON PROGAMMING LANGUAGE
[SUBMITTED IN PARTIAL FULFILLMENT OF B.VOC-SOFTWARE DEVELOPMENT
(2018- 2021)]
AS A PART OF THE CURRICULUM OF BACHELOR OF VOCATION
[B.VOC-(SD)]
FROM

BHAI PARMANAND INSTITUTE OF


BUSINESS STUDIES, DELHI–92
Guru Gobind Singh Indraprastha University, Delhi

SUBMITTED BY: SUBMITTED TO:


MANISH RAWAT PRIYANKA MAM
BVOC(SD)4TH SEM BVOC(SD)DEPT.
01711418118
ACKNOWLEDGEMENT

IT IS TO CERTIFY THAT MR. MANISH RAWAT


STUDENT OF B.VOC-(SD), OF BHAI PARMANAND
INSTITUTE OF BUSSINESS STUDIES, SHAKARPUR
DELHI-11092, COORDINATED 60 DAYS TRAINING ON
“PYTHON PROGRAMMING LANGUAGE” FOR HIS
COLLEGE STUDENTS FROM 28/01/2020 TO 27/03/2020.
I AM GREATLY THANKFUL TO OUR TRAINING
TEACHER MRS. MALYA MAM FOR HER KIND
SUPPORT AND GUIDANCE TO SUCCESSFUL
COMPLETE MY TRAINING. I HAVE HIGHLY
BENIFITED BY THIS TRAINING AND HAVE GAINED A
LOT OF KNOWLEDGE ABOUT THE VARIOUS
PROCESS AND TECHNIQUES EMPLOYED IN RSP.
HE WILL BE AN ASSET TO ANY ORGANIZATION
WHERE HE IS SUITABLY PLACED. WE WISH HIM
EVERY SUCCESS IN HIS FUTURE LIFE.
INDEX
TABLE OF CONTENTS PAGE NO.

1. Python introduction
1.1 Beginning Python Programming
1.2 Python history and version
1.3 Python feature
1.4 Python application
2. How to install Python
2.1 installation on window
2.2 Unix and Linux installation
3. Python variable
3.1 Type of variables
4. Data types
5. Operators of Python
5.1 Type of operators
6. Decision making
6.1. if statement
6.2 if-else statement
7. Loops in Python
7.1While loop
7.2 For loop
8. Python function
8.1 required argument
8.2 keyword argument
8.3 Default argument
8.4 Variable length argument
9. File handling
10. Python Oops concept
10.1 object
10.2 class
10.3 Inheritance
10.4 Polymorphism
10.5 encapsulation
11. Database in python
11.1 what is database
11.2 RDBMS terminology
11.3 what is MySQL dB
11.4 how do install MySQL dB
11.5 how MySQL works
12. Python module
13. GUI programming (Tkinter) in python
14. Tkinter programming
15. What is pip?
15.1 installation package with pip
19. Project in Python
19.1 Abstract
19.2 Graphical user interface with TK
19.3 Tkinter Programming
20. Requirement Specification
20. 1 Software requirement specification
20.2 Hardware requirement specification
21. Diagram
21.1 0 level DMD
21.2 Usage case diagram
22. Snapshot
22.1 Snapshot
22.2 Snapshot
23. Conclusion
24. Reference
Python
1. Python Language Introduction
Python is a widely used general-purpose, high level programming
language. It was initially designed by Guido van Rossum in 1991 and
developed by Python Software Foundation. It was mainly developed for
emphasis on code readability, and its syntax allows programmers to
express 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.

1.1 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.
Windows: There are many interpreters available freely to run Python
scripts like IDLE (Integrated Development Environment) which is
installed when you install the python software from http://python.org/
Linux: For Linux, Python comes bundled with the Linux.
2) Writing first program:
Following is first program in Python
JI Script Begins
print ("Geeks Quiz”) # Scripts Ends
Output:
Geeks Quiz
1.2 Python History and Versions
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. In February 1991, van Rossum published the code
(labelled version 0.9.0) to alt. sources. In 1994, Python 1.0 was released
with new features like: lambda, map, filter, and reduce. Python 2.0
added new features like: list comprehensions, garbage collection
system. On December 3, 2008, Python 3.0 (also called "Py3K") was
released. It was designed to rectify fundamental flaw of the language.
ABC programming language is said to be the predecessor of Python
language which was capable of Exception Handling and interfacing with
Amoeba Operating System.
1.3 Python Features
 Easy to Learn and Use: Python is easy to learn and use. It is
developer-friendly and high-level programming language.
 It is more understandable and readable.
 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.
 Cross-platform Language: Python can run equally on different
platforms such as Windows, Linux, Unix and Macintosh etc. “] So,
we can say that Python is a portable language.
 Free and Open Source: Python language is freely available at
official. The source-code is also available. Therefore, it is open
source.
 Object-Oriented Language: Python supports object-oriented
language and concepts of classes and objects come into
existence.
 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 our
python code.
 Large Standard Library: Python has a large and broad library and
provides rich set of module and functions for rapid application
development.
 GUI Programming Support: Graphical user interfaces can be
developed using Python.
 Integrated: It can be easily integrated with languages like C, C++,
JAVA etc.

1.4 Python Applications


1) Web Applications
We can use Python to develop web applications. It provides libraries to
handle internet protocols such as HTML and XML, JSON, Email
processing, request, beautiful Soup, Feed parser etc. It also provides
Frameworks such as dynamic, Pyramid, Flask etc to design and develop
web-based applications.
2) Desktop GUI Applications
Python provides Tk GUI library to develop user interface in python-based
application. Some other useful toolkits wx-Widgets, Kivy that are useable
on several platforms. The Kivy is popular for writing multi touch
applications.
3) Software Development
Python is helpful for software development process. It works as a
support language and can be used for build control and management,
testing etc.
4) Scientific and Numeric
Python is popular and widely used in scientific and numeric computing.
Some useful library and package are SciPy, Pandas, Python etc. SciPy
is group of packages of engineering, science and mathematics.
5) Business Applications
Python is used to build Business applications like ERP and e-commerce
systems. Tryton is a high-level application platform.
6) Console Based Application
We can use Python to develop console-based applications. For
example: lPython.
7) Audio or Video based Applications
Python is awesome to perform multiple tasks and can be used to
develop multimedia applications. Some of real applications are:
TimPlayer, cplay etc.
8) 3D CAD Applications
To create CAD application Fandango is a real application which provides
full features of CAD.
9) Enterprise Applications
Python can be used to create applications which can be used within an
Enterprise or an Organization. Some real time applications are: Open
ERP, Tryton, Picalo etc.
10) Applications for Images
Using Python several applications can be developed for image.
Applications developed are: VPython, Gogh, imgseek etc.
2. How to Install Python
2.1 Installation on Windows
Visit the link https://www.python.org/downloads/ to download the latest
release of Python. In this process, we will install Python 3.6.7 on our
Windows operating system.
Double-click the executable file which is downloaded; the following
window will open. Select customize installation and proceed.
All the features need to be installed and are checked by default; we
need to click next to continue.
Check all the options which you want to install and click next.
Now, we are ready to install python-3.6.7. Let's install it.
2.2 Unix and Linux Installation
Here are the simple steps to install Python on Unix/Linux machine.
 Open a Web browser and go to
https://www.python.org/downloads/.
 Follow the link to download zipped source code available for
Unix/Linux.
 Download and extract files.
 Editing the Modules/Setup file if you want to customize some
options.
 run ./configure script
 make install
This installs Python at standard location /usr/local/bin and its libraries
/usr/local/lib/pythonXX where XX is the version of Python.
Setting path at Unix/Linux
To add the Python directory to the path for a particular session in Unix
 In the csh shell - type setenv PATH "$PATH:/usr/local/bin/python"
and press Enter.
 In the bash shell (Linux) - type export
PATH="$PATH:/usr/local/bin/python" and press Enter.
 In the sh or ksh shell - type PATH="$PATH:/usr/local/bin/python"
and press Enter.
 Note - /usr/local/bin/python is the path of the Python directory
3. Python Variables
Variables are nothing but reserved memory locations to store values. It
means that when you create a variable, you reserve some space in the
memory. Based on the data type of a variable, the interpreter allocates
memory and decides what can be stored in the reserved memory.
Therefore, by assigning different data types to the variables, you can
store integers, decimals or characters in these variables.
3.1 Types of variables
1. Assigning Values to Variables
Assigning Values to Variables Python variables do not need explicit
declaration to reserve memory space. The declaration happens
automatically when you assign a value to a variable. The equal sign (=)
is used to assign values to variables. The operand to the left of the =
operator is the name of the variable and the operand to the right of the =
operator is the value stored in the variable. For example-

3.2 Multiple Assignment


Python allows us to assign a value to multiple variables in a single
statement which is also known as multiple assignment. We can apply
multiple assignments in two ways either by assigning a single value to
multiple variables or assigning multiple values to multiple variables. Let’s
see given examples
1. Assigning single value to multiple variables
Eg : - x=y=z
Print iple
Print y
Print z
Output:
50
50
50
2. Assigning multiple values to multiple variables:
Eg:
a, b, c= 5,10,15
print a
print b
print c
Output:
5
10
15
4. Data Types in python
The data stored in memory can be of many types. For example, a
person's age is stored as a numeric value and his or her address is
stored as alphanumeric characters. Python has various standard data
types that are used to define the operations possible on them and the
storage method for each of them.
4.1 Data types
Python has five standard data types-
 Numbers
 String
 List
 Tuple
 Dictionary
Numbers
Number stores numeric values. Python creates Number objects when a
number is assigned to a variable. For example; a = 3, b = 5 tea and b
are number objects. Python supports 4 types of numeric data. int (signed
integers like 10, 2, 29, etc.) long (long integers used for a higher range of
values like 908090800L, -0x1929292L, etc.) float (float is used to store
floating point numbers like 1.9, 9.902, 15.2, etc.) complex (complex
numbers like 2.14j, 2.0 + 2.3j, etc.)
String
The string can be defined as the sequence of characters represented in
the quotation marks. In python, we can use single, double, or triple
quotes to define a string. String handling in python is a straightforward
task since there are various inbuilt functions and operators provided.
The following example illustrates the string handling in python.
str1 = ’hello javatpoint’ #string str1 str2 - ’ how are you' #string
str2 print (str1[0:2]) Sprinting first two character using slice operator print
(str1[4]) #printing 4th character of the string
print (str1*2) #printing the string twice
print (str1 + str2) #printing the concatenation of str1 and str2
Output:
hello javatpointhello javatpoint hello javatpoint how are you
List
Lists are similar to arrays in C. However; the list can contain data of
different types. The items stored in the list are separated with a comma
(,) and enclosed within square brackets []. We can use slice (:] operators
to access the data of the list. The concatenation operator (+) and
repetition operator (*) works with the list in the same way as they were
working with the strings.
Consider the following example. I = [1, "hi", "python", 2]
print (I[3:]);
print (I[0:2]);
print (I); print (I + I); print (I ” 3);
Output:
[1, 'hi']
[1, 'hi', 'python’, 2]
[1, 'hi', 'python’, 2, 1, ’hi', 'python', 2]
[1, 'hi', 'python', 2, 1, 'hi', 'python', 2, 1, 'hi', 'python', 2]
Tuple
A tuple is similar to the list in many ways. Like lists, tuples also contain
the collection of the items of different data types. The items of the tuple
are separated with a comma (,) and enclosed in parentheses (). A tuple
is a read-only data structure as we can't modify the size and value of the
items of a tuple.
Let's see a simple example of the tuple. t = ("hi", "python", 2)
Print (t[1:]);
Print (t[0:1]);
Print (t);
Print (t + t);
Print (t * 3);
Print (type(t))
t[2] = ”hi";
Output:
('python', 2)
('hi',)
('hi’, 'python', 2)
('hi', 'python', 2, ’hi', 'python', 2)
(’hi', ’python’, 2, 'hi’, 'python', 2, 'hi', 'python', 2)
<type 'tuple'>
Traceback (most recent call last):
File “main.py", line 8, in <module>
t(2) = "hi";
Type Error: ’tuple' object does not support item assignment
Dictionary
Dictionary is an ordered set of a key-value pair of items. It is like an
associative array or a hash table where each key stores a specific value.
Key can hold any primitive data type whereas value is an arbitrary
Python object. The items in the dictionary are separated with the comma
and enclosed in the curly braces ().
5. Operators of python
The operator can be defined as a symbol which is responsible for a
particular operation between two operands. Operators are the pillars of a
program on which the logic is built in a particular programming language.
5.1 Types of Operator
 Arithmetic Operators
 Comparison (Relational) Operators
 Assignment Operators
 Logical Operators
 Bitwise Operators
 Membership Operators
 Identity Operators

1. Arithmetic operators
Arithmetic operators are used to perform arithmetic operations between
two operands. It includes +(addition), - (subtraction), *(multiplication),
/(divide), %(reminder), // (floor division), and exponent (*”).
2. Comparison operator
Comparison operators are used to comparing the value of the two
operands and returns Boolean true or false accordingly.
3. Python assignment operators
The assignment operators are used to assign the value of the right
expression to the left operand. The assignment operators are described
in the following table.
4. Bitwise operator
The bitwise operators perform bit by bit operation on the values of the
two operands.
5. Logical Operators
The logical operators are used primarily in the expression evaluation to
make a decision. Python supports the following logical operators.
6. Membership Operators
Python membership operators are used to check the membership of
value inside a data structure. If the value is present in the data structure,
then the resulting value is true otherwise it returns false.
7. Identity Operators
Identity operators compare the memory locations of two objects. There
are two Identity operators is or is not.
8. Operator Precedence
The precedence of the operators is important to find out since it enables
us to know which operator should be evaluated first.
6. Decision Making
Decision-making is the anticipation of conditions occurring during the
execution of a programs and specified actions taken according to the
conditions. Decision structures evaluate expressions, which produce
TRUE or FALSE as the outcome. You need to determine which action to
take and which statements to execute if the outcome is TRUE or FALSE
otherwise
6.1 IF Statement
The IF statement is similar to that of other languages. The if statement
contains a logical expression using which the data is compared and a
decision is made based on the result of the comparison.
6.2 if-else statement
An else statement can be combined with an if statement. An else
statement contains a block of code that executes if the conditional
expression in the if statement resolves to 0 or a FALSE value.
7. LOOPS IN PYTHON
Python programming language provides following types of loops to
handle looping requirements. Python provides three ways for executing
the loops. While all the ways provide similar basic functionality, they
differ in their syntax and condition checking time.
7.1 While Loop
In python, while loop is used to execute a block of statements repeatedly
until a given a condition is satisfied. And when the condition becomes
false, the line immediately after the loop in program is executed.
Syntax:
while expression:
statement(s)
Using else statement with while loops: As discussed above, while loop
executes the block until a condition is satisfied. When the condition
becomes false, the statement immediately after the loop is
executed.
The else clause is only executed when your while condition becomes
false. If you break out of the loop, or if an exception is raised, it won’t be
executed.
Single statement while block: Just like the if block, if the while block
consists of a single statement the we can declare the entire loop in a
single line as shown below:
Note: It is suggested not to use this type of loops as it is a never ending
infinite loop where the condition is always true and you have to forcefully
terminate the compiler.
7.2 For in Loop
For loops are used for sequential traversal. For example: traversing a list
or string or array etc.
In Python, there is no C style for loop, i.e., for (i=0; i<n; i++). There is “for
in” loop which is similar to for each loop in other languages. Let us learn
how to use for in loop for sequential traversals.
Syntax:
for iterator var in sequence:
statements(s)
It can be used to iterate over iterators and a range.
Using else statement with for loops:
We can also combine else statement with for loop like in while loop. But
as there is no condition in for loop based on which the execution will
terminate so the else block will be executed immediately after for block
finishes execution. A final note on loop nesting is that we can put any
type of loop inside of any other type of loop.
1. 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.
 Continue Statement: It returns the control to the beginning of the
loop.
 Break Statement: It brings control out of the loop
 Pass Statement: We use pass statement to write empty loops.
Pass is also used for empty control statement, function and
classes.
8. Python Functions
Functions are the most important aspect of an application. A function
can be defined as the organized block of reusable code which can be
called whenever required. Python allows us to divide a large program
into the basic building blocks known as function. The function contains
the set of programming statements enclosed by (). A function can be
called multiple times to provide reusability and modularity to the python
program.
Advantage of functions in python program.
 We can track a large python program easily when it is divided into
multiple functions.
 Reusability is the main achievement of python functions.
However, Function calling is always overhead in a python program.
Types of arguments
There may be several types of arguments which can be passed at the
time of function calling.
 Required arguments
 Keyword arguments
 Default arguments
 Variable-length arguments
8.1 Required Arguments
Till now, we have learned about function calling in python. However, we
can provide the arguments at the time of function calling. As far as the
required arguments are concerned, these are the arguments which are
required to be passed at the time of function calling with the exact match
of their positions in the function call and function definition.
8.2 Keyword arguments
Python allows us to call the function with the keyword arguments. This
Lind of function call will enable us to pass the arguments in the random
order.
The name of the arguments is treated as the keywords and matched in
the function calling and definition. If the same match is found, the values
of the arguments are copied in the function definition.
8.3 Default Arguments
Python allows us to initialize the arguments at the function definition. If
the value of any of the argument is not provided at the time of function
call, then that argument can be initialized with the value given in the
definition
8.4 Variable length Arguments
In the large projects, sometimes we may not know the number of
arguments to be passed in advance. In such cases, Python provides us
the flexibility to provide the comma separated values which are internally
treated as tuples at the function call.
Scope of variables
The scopes of the variables depend upon the location where the variable
is being declared. The variable declared in one part of the program may
not be accessible to the other parts.
In python, the variables are defined with the two types of scopes.
Global variables Local variables
The variable defined outside any function is known to have a global
scope whereas the variable defined inside a function is known to have a
local scope.
File handling: -
The key function for working with files in Python is the open () function.
The open () function takes two parameters; filename, and mode.
There are four different methods (modes) for opening a file:
• "r" - Read - Default value. Opens a file for reading, error if the file does
not exist
• "a" - Append - Opens a file for appending, creates the file if it does not
exist
• "w" - Write - Opens a file for writing, creates the file if it does not exist
• "x" - Create - Creates the specified file, returns an error if the file exists
• In addition, you can specify if the file should be handled as binary or
text mode
• "t" - Text - Default value. Text mode
• "b" - Binary - Binary mode (e.g. images)
9. Python OOPs Concepts
Like other general-purpose languages, python is also an object-oriented
language since its beginning. Python is an object-oriented programming
language. It allows us to develop applications using an Object-Oriented
approach. In Python, we can easily create and use classes and objects.
Major principles of object-oriented programming system are given below.
 Object
 Class
 Method
 Inheritance Polymorphism
 Data Abstraction
 Encapsulation
9.1. Object
The object is an entity that has state and behaviour. It may be any real-
world object like the mouse, keyboard, chair, table, pen, etc.
Everything in Python is an object, and almost everything has attributes
and methods. All functions have a built-in attribute doc which returns
the doc string defined in the function source code.
9.2 Class
The class can be defined as a collection of objects. It is a logical entity
that has some specific attributes and methods. For example: if you have
an employee class then it should contain an attribute and method, i.e. an
email id, name, age, salary, etc.
9.3 Inheritance
Inheritance is the most important aspect of object-oriented programming
which simulates the real-world concept of inheritance. It specifies that
the child object acquires all the properties and behaviours of the parent
object. By using inheritance, we can create a class which uses all the
properties and behaviour of another class. The new class is known as a
derived class or child class, and the one whose properties are acquired
is known as a base class or parent class.
9.4 Polymorphism
Polymorphism contains two words "poly" and "morphs". Poly means
many and Morphs means form, shape. By polymorphism, we understand
that one task can be performed in different ways. For example, you have
a class animal, and all animals speak. But they speak differently. Here,
the "speak" behaviour is polymorphic in the sense and depends on the
animal.
9.5 Encapsulation
Encapsulation is also an important aspect of object-oriented
programming. It is used to restrict access to methods and variables. In
encapsulation, code and data are wrapped together within a single unit
from being modified by accident.
Database in Python: -
The Python standard for database interfaces is the Python DB-API. Most
Python database interfaces adhere to these standards. You can choose
the right database for your application. Python Database API supports a
wide range of database servers such as –
• GadFly
• mSQL
• MySQL
• PostgreSQL
• Microsoft SQL Server 2000
• Informix
• lnterbase
• Oracle
• Sybase
Here is the list of available Python database interfaces: Python
Database Interfaces and APIs. You must download a separate DB API
module for each database you need to access. For example, if you need
to access an Oracle database as well as a MySQL database, you must
download both the Oracle and the MySQL database modules.
The DB API provides a minimal standard for working with databases
using Python structures and syntax wherever possible. This API includes
the following -
 Importing the API module.
 Acquiring a connection with the database.
 Issuing SQL statements and stored procedures.
 Closing the connection
We would learn all the concepts using MySQL, so let us talk about
MySQL dB module.
11.1 What is a Database?
A database is a separate application that stores a collection of data.
Each database has one or more distinct APIs for creating, accessing,
managing, searching and replicating the data it holds. Other kinds of
data stores can also be used, such as files on the file system or large
hash tables in memory but data fetching and writing would not be so fast
and easy with those type of systems. Nowadays, we use relational
database management systems (RDBMS) to store and manage huge
volume of data. This is called relational database because all the data is
stored into different tables and relations are established using primary
keys or other keys known as Foreign Keys.
A Relational Database Management System (RDBMS) is a software that
• Enables you to implement a database with tables, columns
and indexes.
• Guarantees the Referential Integrity between rows of various
tables.
• Updates the indexes automatically.
• Interprets an SQL query and combines information from
various tables.

11.2 RDBMS Terminology


Before we proceed to explain the MySQL database system, let us revise
a few definitions related to the database.
• Database - A database is a collection of tables, with related
data.
• Table - A table is a matrix with data. A table in a database
looks like a simple spreadsheet.
• Column - One column (data element) contains data of one
and the same kind, for example the column postcode.
• Row - A row (= tuple, entry or record) is a group of related
data, for example the data of one subscription.
• Redundancy - Storing data twice, redundantly to make the
system faster.
• Primary Key - A primary key is unique. A key value cannot
occur twice in one table. With a key, you can only find one
row.
• Foreign Key - A foreign key is the linking pin between two
tables.
• Compound Key - A compound key (composite Ley) is a key
that consists of multiple columns, because one column is not
sufficiently unique.
• Index - An index in a database resembles an index at the
back of a book.
11.3 What is MySQL dB?
MySQL dB is an interface for connecting to a MySQL database server
from Python. It implements the Python Database API v2.0 and is built on
top of the MySQL C API.
MySQL is a fast, easy-to-use RDBMS being used for many small and
big businesses. MySQL is developed, marketed and supported by
MySQL AB, which is a Swedish company. MySQL is becoming so
popular because of many good reasons -
• MySQL is released under an open-source license. So you
have nothing to pay to use it.
• MySQL is a very powerful program in its own right. It handles
a large subset of the functionality of the most expensive and
powerful database packages.
• MySQL uses a standard form of the well-known SQL data
language.
• MySQL works on many operating systems and with many
languages including PHP, PERL, C, C++, JAVA, etc.
• MySQL works very quickly and works well even with large
data sets.
• MySQL is very friendly to PHP, the most appreciated
language for web development.
• MySQL supports large databases, up to 50 million rows or
more in a table. The default file size limit for a table is 4GB,
but you can increase this (if your operating system can
handle itj to a theoretical limit of 8 million terabytes (TB).
• MySQL is customizable. The open-source GPL license
allows programmers to
• modify the MySQL software to fit their own specific
environments.

11.4 How do I Install MySQL dB?


MySQL dB is an Oracle-backed open source relational database
management system (RDBMS) based on SQL. MySQL runs on virtually
all platforms, including Linux, UNIX and Windows.
Although it can be used in a wide range of applications, MySQL is most
often associated with web applications and online publishing. MySQL is
an important component of an open source enterprise stack called
LAMP. LAMP is a web development platform that uses Linux as the
operating system, Apache as the web server, MySQL as the relational
database management system and PHP as the object-oriented scripting
language. (Sometimes Perl or Python is used instead of PHP.) Originally
conceived by the Swedish company MySQL AB, MySQL was acquired
by Sun Microsystems in 2008 and then by Oracle when it bought Sun in
2010. Developers can use MySQL under the GNU General Public
License (GPL), but enterprises must obtain a commercial license from
Oracle.
11.5 How MySQL works?
MySQL is based on a client-server model. The core of MySQL is MySQL
server, which handles all of the database instructions (or commands).
MySQL server is available as a separate program for use in a client-
server networked environment and as a library that can be embedded
(or linked) into separate applications.
• MySQL operates along with several utility programs which
support the administration of
• MySQL databases. Commands are sent to MySQL Server
via the MySQL client, which is
• installed on a computer.
• MySQL was originally developed to handle large databases
quickly. Although MySQL is
• Typically installed on only one machine, it is able to send the
database to multiple locations,
• As users are able to access it via different MySQL client
interfaces. These interfaces send
• SQL statements to the server and then display the results.
Before proceeding, you make sure you have MySQL dB installed on
your machine. Just type the following in your Python script and execute it
- #!/usr/bin/python import MySQLdb
10. PYTHON MODULES
A module is a file containing Python definitions and statements. A
module can define functions, classes and variables. A module can also
include runnable code. Grouping related code into a module makes the
code easier to understand and use.
The import statement
We can use any Python source file as a module by executing an import
statement in some other Python source file. When interpreter encounters
an import statement, it imports the module if the module is present in the
search path. A search path is a list of directories that the interpreter
searches for importing a module.
11. GUI Programming in python
Python provides various options for developing graphical user interfaces
(GUIs). The most important features
 Tkinter: Tkinter is the Python interface to the Tk GUI toolkit
shipped with Python. We would look at this option in this chapter.
 wxPython: This is an open-source Python interface for wxWidgets
GUI toolkit. You can find a complete tutorial on WxPython
 PyQt: This is also a Python interface for a popular cross-platform
Qt GUI library. Tutorials Point has a very good tutorial on PyQt
 JPython: JPython is a Python port for Java, which gives Python
scripts seamless access to the
 Java class libraries on the local machine
12. Tkinter Programming
Tkinter is the standard GUI library for Python. Python when combined
with Tkinter provides an interface to the Tk GUI toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to
do is perform the following steps —
Import the Tkinter module.
• Create the GUI application main window.
• Add one or more of the above-mentioned widgets to the GUI
application.
• Enter the main event loop to take action against each event
triggered by the user
• Example #!/usr/bin/python import Tkinter
• top = Tkinter.Tk()
• # Code to add widgets will go here... top.mainloop()
Tkinter Widgets
Tkinter provides various controls, such as buttons, labels and text boxes
used in a GUI application. These controls are commonly called widgets.
13. WHAT IS PIP?
pip is a package manager for Python. That means it’s a tool that allows
you to install and manage additional libraries and dependencies that are
not distributed as part of the standard library.
The Python installer installs pip, so it should be ready for you to use,
unless you installed an old version of Python. You can verify that pip is
available by running the following command in your console:
$ pip —version
pip 18.1 from C:\Python37\lib\site-packages\pip (python 3.7)
You should see a similar output displaying the pip version, as well as the
location and version of Python. If you are using an old version of Python
that does not include pip, then you can install it by following the
instructions for your system in the pip installation documentation.
You probably want to follow the examples in this tutorial inside a virtual
environment to avoid installing packages to the global Python
installation. You can learn about virtual environments in Python Virtual
Environments: A Primer. The Using Virtual Environments section of that
article explains the basics of creating new virtual environments.
13.1 Installing Packages with pip
Python is considered a battery included language. This means that the
Python standard library includes an extensive set of packages and
modules to help developers with their scripts and applications. At the
same time, Python has a very active community that contributes an even
bigger set of packages that can help you with your development needs.
These packages are published to the Python Package Index, also
known as PPI (pronounced Pie Pea Eye). PPl hosts an extensive
collection of packages that include development frameworks, tools, and
libraries. Many of these packages simplify Python development by
providing friendly interfaces to functionality that already exists in the
standard library.
14. OpenCV
OpenCV was started at Intel in 1999 by Gary Bradsky and the first
release came out in 2000.
Vadim Pisarevsky joined Gary Bradsky to manage Intel’s Russian
software OpenCV team. In 2005, OpenCV was used on Stanley, the
vehicle who won 2005 DARPA Grand Challenge. Later its active
development continued under the support of Willow Garage, with Gary
Bradsky and Vadim Pisarevsky leading the project. Right now, OpenCV
supports a lot of algorithms related to Computer Vision and Machine
Learning and it is expanding day-by-day.
Currently OpenCV supports a wide variety of programming languages
like C++, Python, Java etc and is available on different platforms
including Windows, Linux, OS X, Android, iOS etc. Also, interfaces
based on CUDA and OpenCL are also under active development for
high-speed GP operations.
OpenCV-Python is the Python API of OpenCV. It combines the best
qualities of OpenCV C++ API and Python language.
Project

Bank Management System:

Bank Management System project is written in Python. This is a simple


console-based system which is very easy to understand and use.
Talking about the system, it contains all the basic functions which
include creating a new account, view account holders record, withdraws
and deposit amount, balance inquiry, closing an account and edit
account details. In this mini project, there is no such login system. This
means he/she can use all those available features easily without any
restriction. It is too easy to use, he/she can check the total bank account
records easily.

Talking about the features of the Bank Management System, a user can
create an account by providing the name of the account holder, number,
selecting amount type (Saving account or Current account) and
providing an initial amount more than or equal to 500. Then the user can
also deposit and withdraw money just by providing his/her account and
entering the amount. For certain purpose, he/she can also check for the
balance inquiry which displays the account number and amount. He/she
can also view all the account holder’s list. Another feature is that he/she
can modify their account detail and type if they want to.

This simple console-based Bank Management system provides the


simplest management of bank account and transaction. In short, this
projects mainly focus on CRUD. There’s an external database
connection file used in this mini project to save user’s data permanently.

Fundamental Features:

• Create a new account and view account holders record.


• Withdraws and deposit amount with the balance inquiry.
• Closing an account and edit account details.
• User can create an account by providing the name of the
account holder, number, etc.
• User can select the amount type (Saving or Current account).
• They can also provide an initial amount more than or equal to
500.
• He/she can modify their account detail and type if they want to.

Source code

#import sys;
class BankAccount:
def __init__(self, accountNumber, name ):
self.__accountNumber = accountNumber
self.__name = name
def get_account_number(self):
return self.__accountNumber
def get_name(self):
return self.__name
def set_account_number(self, value):
self.__accountNumber = value
def set_name(self, value):
self.__name = value
class FixedDeposit(BankAccount):
def __init__(self, accountNumber, name, duration, amount,
rateOfInterest ):
super().__init__(accountNumber,name)
self.__duration = duration
self.__amount = amount
self.__rateOfInterest = rateOfInterest
def get_duration(self):
return self.__duration
def get_amount(self):
return self.__amount
def get_rate_of_interest(self):
return self.__rateOfInterest
def set_duration(self, value):
self.__duration = value
def set_amount(self, value):
self.__amount = value
def set_rate_of_interest(self, value):
self.__rateOfInterest = value
class RecurringDeposit(BankAccount):
def __init__(self, accountNumber, name, duration, monthlyPayment,
rateOfInterest ):
super().__init__(accountNumber,name)
self.__duration = duration
self.__monthlyPayment = monthlyPayment
self.__rateOfInterest = rateOfInterest
def get_duration(self):
return self.__duration
def get_monthly_payment(self):
return self.__monthlyPayment
def get_rate_of_interest(self):
return self.__rateOfInterest
def set_duration(self, value):
self.__duration = value
def set_monthly_payment(self, value):
self.__monthlyPayment = value
def set_rate_of_interest(self, value):
self.__rateOfInterest = value
class BankDemo:
n=0
ch='n'
def bankOptions(self):
print("******************************")
print(" Bank Account Demonstration ")
print("******************************")
print("1. Read & Write Fixed Deposit")
print("2. Read & Write Recurring Deposit")
print("3. Exit")
n=int(input("\nSelect your choice : "))
if n==1:
self.readWriteFixedDeposit()
elif n==2:
self.readWriteRecurringDeposit()
elif n==3:
print("Thank You!!!")
exit()
else:
print("invalid option!\n try again\n")
self.bankOptions()
def readWriteFixedDeposit(self):
print("\nGive Fixed Deposit Details\n")
j=0
while(j==0):
try:
accountNumber = int(input("Enter Account Number: ").strip())
j=1
except:
print("Please try again")
name =input("Enter Account Name: ").strip()
j=0
while(j==0):
try:
duration = int(input("Duration: ").strip())
j=1
except:
print("Please try again")
j=0
while(j==0):
try:
amount = float(input("Amount: ").strip())
j=1
except:
print("Please try again")
j=0
while(j==0):
try:
rateOfInterest = float(input("Rate of Interest: ").strip())
j=1
except:
print("Please try again")
fd = FixedDeposit(accountNumber, name, duration, amount,
rateOfInterest)
print("\nFixed Deposit Details are...\n")
print("\nAccount Number: ", fd.get_account_number())
print("Account Name: ", fd.get_name())
print("Duration: ", fd.get_duration())
print("Amount: ", fd.get_amount())
print("Rate of Interest: ", fd.get_rate_of_interest())
def readWriteRecurringDeposit(self):
print("\nGive Recurring Deposit Details\n")
j=0
while(j==0):
try:
accountNumber = int(input("Enter Account Number: ").strip())
j=1
except:
print("Please try again")
name =input("Enter Account Name: ").strip()
j=0
while(j==0):
try:
duration = int(input("Duration: ").strip())
j=1
except:
print("Please try again")
j=0
while(j==0):
try:
monthlyPayment = float(input("Monthly Payment: ").strip())
j=1
except:
print("Please try again")
j=0
while(j==0):
try:
rateOfInterest = float(input("Rate of Interest: ").strip())
j=1
except:
print("Please try again")
rd = RecurringDeposit(accountNumber, name, duration,
monthlyPayment, rateOfInterest)
print("\nRecurring Deposit Details are...\n")
print("\nAccount Number: ", rd.get_account_number())
print("Account Name: ", rd.get_name())
print("Duration: ", rd.get_duration())
print("Monthly Payment: ", rd.get_monthly_payment())
print("Rate of Interest: ", rd.get_rate_of_interest())
def gotooptions(self):
if self.n!=3:
ch=input("\nDo you wish to continue(y/n)").strip()
if(ch[0]=='y' or ch[0]=='Y'):
BankDemo.bankOptions(self)
else:
print("Thank you!")
exit()
demoObject = BankDemo()
demoObject.bankOptions()
demoObject.gotooptions()

Outputs
Conclusion

Bank management system is a virtualization of transactions in banking


system. The banking system are used manual working but when we
used online banking system it is totally virtualization process which avoid
manual process and converts it in automatic process. If user can make a
transaction in bank management system it is available in any were also
user can link Aadhar with account, change branch location easily. Bank
management system is saving the time with accuracy than bank manual
system.
From all the information we can create a bank management system. The
whole process of banking is showed in the code like creating new
account, displaying details, deposits, withdraw. Hence, we can conclude
that Project is accomplished successfully.

You might also like