0% found this document useful (2 votes)
1K views31 pages

Atm

Python is an interpreted, object-oriented, high-level programming language created by Guido van Rossum in 1991. It has a simple syntax and philosophy of "there should be one obvious way to do it". Python supports multiple programming paradigms including object-oriented, imperative, and functional programming. It is open source, cross-platform, and popular for web and scripting applications. Major versions include Python 2.0 in 2000 and Python 3.0 in 2008 which introduced backwards incompatible changes from Python 2.x. Key features of Python include being dynamic, high-level, interpreted, supporting object-oriented and procedural programming.

Uploaded by

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

Atm

Python is an interpreted, object-oriented, high-level programming language created by Guido van Rossum in 1991. It has a simple syntax and philosophy of "there should be one obvious way to do it". Python supports multiple programming paradigms including object-oriented, imperative, and functional programming. It is open source, cross-platform, and popular for web and scripting applications. Major versions include Python 2.0 in 2000 and Python 3.0 in 2008 which introduced backwards incompatible changes from Python 2.x. Key features of Python include being dynamic, high-level, interpreted, supporting object-oriented and procedural programming.

Uploaded by

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

CHAPTER-1

PROJECT ON ATM SYSTEM

1.1 Introduction:

Few years ago, transaction of money was only through bank, but now everyone can withdraw the
money through a machine called ATM (Automated Teller Machine). This was initially created
by Luther George Simjian, he was a photographer, inventor and businessman from Turkish.

The ATM’s are the electronic devices or machines and these can be operated by customers at any
time even after the working hours of bank. For using this machine, the customer just needs to
have a savings or current account and with this the customer gets his ATM card which is a plastic
card and this has a unique number and magnetic code. This code can be read by the machine
easily and for operating this card the customer has to put the card in the machine and this reads
the code and based on the given PIN number it authenticates the information the customer can
draw money.

There are various advantages of ATM, the customer can withdraw money at any time of the day
and even in night and also can draw huge amount through it. Now a days withdrawing of money
can be made through any banks ATM and these are located in almost every area for convince of
the customer. ATM’s also available at Bus station, Railway station etc.

The Advantages of an Automated Teller Machine

Automated teller machines allow you to perform certain bank transactions without having to
stand in line and get assistance from a bank teller. They are simple to use with a keypad and
touch-screen system, can save you time and are usually located in well-lit and convenient areas.
Some ATMs even have security cameras located over them to add a measure of safety.

24-Hour Access

If you are running low on cash and it's later in the evening when all of the banks are closed, you
can go to an automated teller machine to get money from your bank account. Instead of having
to complete a withdrawal slip or write a check out to cash, you can use your bank-issued ATM

1
card or a credit card to access your money. You have the option to receive printed receipts of
your transactions as well as perform more than one transaction while at the ATM.

Convenience

Many banks have automated teller machines located inside or outside of their locations. Some
banks even have ATMs as a part of one of their drive-thru lanes so that you can remain in your
vehicle while using them. An advantage of automated teller machines is that you can access your
money for free if you use an ATM at a bank where you have a checking and/or savings account.
Many banks also allow you to withdraw money from credit cards that are not issued by their
institution for a small fee. Some banks also have ATMs in other locations such as retail and
grocery stores and some businesses provide ATMs for their customers and charge a small
processing fee.

Deposits

Another advantage of an automated teller machine is that you can make deposits into your bank
account through them as well. You can make cash and check deposits, and some banks do not
require submitting a deposit slip with your transaction. Some ATMs allow you to get the total
remaining balance of your account on the screen or printed on your transaction receipt. ATMs at
banks sometimes provide customers with the ability to transfer funds between accounts by using
the touch-screen system, or you can withdraw money from one card and then deposit the money
into a second account using another card.

The Disadvantages of ATMs

Automated teller machines, or ATMs, are a convenient way to access your money without having
to go into a bank and work with a bank teller. ATMs give you the opportunity to withdraw and
deposit money, as well as check your balances at the touch of a button. Although ATMs are
convenient, there are disadvantages to using these machines.

Privacy

Privacy is not guaranteed because ATM transactions are completed using a keypad or touch
screen. The people standing nearby may be able to see your personal identification number, or
PIN, and account balance information, making it easier to steal your identity. However, once you
are inside a bank, the account numbers and other personal information are maintained behind a
desk and the information is more secure.

2
Fees

Although there are regulations that provide you with the option of opting out of various fees,
using an ATM machine and a debit card generally leads to fees and charges. If your account
balance is less than your requested withdrawal amount, some machines will still allow you to
withdraw funds. This leads to a fee for overdrawing your account. You also run the risk of fees
for using the ATMs of other banks. These fees may originate from your bank or from the bank
you are using. In some instances, both banks will charge you a fee to withdraw the money.

ATM Card

Having a physical ATM card in your possession is a disadvantage. For one thing, you have to
protect the card. If it is lost or stolen, it can be used by the finder, which can lead to potential
losses for you. Another problem is the machine taking your card. If you enter the wrong PIN or
the machine malfunctions, your card may disappear into the machine. Then you may have to
order a new card, or wait for the bank to open the next day.

1.2 IMPLEMENTATION OF PROJECT AND OUTPUT

The first screen will appear as:

Figure 1 First screen of output

After you enter the correct pin it will show:

3
Figure 2 After Entering Pin

For balance inquiry following result is shown

Figure 3 balance enquiry


For cash withdrawal this result will be shown:

Figure 4 Cash Withdrawal

4
For depositing amount, you will have following output:

Figure 5 Cash Deposit


For PIN Change, you will have following output:

Figure 6 PIN Change

5
For Terminating the program output is shown as:

Figure 7 Termination

6
Chapter 2
About Place Azure

PlaceAzure is established in 2019. PlaceAzure is a place that provide the platform


to students to groom their professional skills before entering the world of
Corporate.

This help the students to start their career with an appreciating performance in the
very initial years of their job and hence progressing their career graph to higher
levels.

PlaceAzure also provides an environment wherein they make their candidates


aware of corporate world and how the Business flows and what role will they be
playing in it.

7
Chapter 3

Introduction to Python

3.1 Introduction

Python is an interpreted, object-oriented, high level scripting and programming language. Python
was first introduced in 1991 by Guido van Rossum, a Dutch computer programmer who wanted
to develop a language that could be used by anyone. The main goal of Python was to reduce the
learning curve by choosing a syntax that is understandable as plain English.

Python has a very simple programming philosophy, "there should be one and preferably only one
obvious way to do it". Python rejects exuberant syntax and favours sparse, less cluttered syntax.
Python is a multi-paradigm programming language, which allows users to code in several
different programming styles. A programmer can code in a functional, object-oriented or
imperative format. Python supports cross platform development and is available through open
source and the latest stable release is version 3.7.4.

3.2 History of Python

Python was originally conceptualized by Guido van Rossum in the late 1980s as a member of the
National Research Institute of Mathematics and Computer Science. Initially, it was designed as
a response to the ABC programming language that was also foregrounded in the Netherlands.
Among the main features of Python compared to the ABC language was that Python had
exception handling and was targeted for the Amoeba operating system.

Python is not named after the snake. It’s named after the British TV show Monty Python.

Of course, Python, like other languages, has gone through a number of versions. Python 0.9.0
was first released in 1991. In addition to exception handling, Python included classes, lists, and
strings. More importantly, it included lambda, map, filter and reduce, which aligned it heavily in
relation to functional programming.

In 2000, Python 2.0 was released. This version of was more of an open-source project from
members of the National Research Institute of Mathematics and Computer Science. This version
of Python included list comprehensions, a full garbage collector, and it supported Unicode.

8
Python 3.0 was the next version and was released in December of 2008 (the latest version of
Python is 3.7.4). Although Python 2 and 3 are similar there are subtle differences.

3.3 Features of Python

Python is a dynamic, high level, free open source and interpreted programming language. It
supports object-oriented programming as well as procedural oriented programming.

There are many features in Python, some of which are discussed below –

1. Easy to code:

Python is high level programming language. Python is very easy to learn language as
compared to other language like c, c#, java script, java etc. It is very easy to code in python
language and anybody can learn python basic in few hours or days. It is also developer-
friendly language.

2. Free and Open Source:

Python language is freely available at official website and you can download it from the given
download link below click on the Download Python keyword.

Download Python

Since, it is open-source, this means that source code is also available to the public .So you
can download it as, use it as well as share it.

3. Object-Oriented Language:

One of the key features of python is Object-Oriented programming. Python supports object
oriented language and concepts of classes, objects encapsulation etc.

4. GUI Programming Support:

Graphical Users interfaces can be made using a module such as PyQt5, PyQt4, wxPython or
Tk in python.

PyQt5 is the most popular option for creating graphical apps with Python.

5. High-Level Language:

10
Python is a high-level language.When we write programs in python, we do not need to
remember the system architecture, nor do we need to manage the memory.

6. Extensible feature:

Python is an Extensible language. We can write some python code into c or c++ language and
also we can compile that code in c/c++ language.

7. Python is Portable language:

Python language is also a portable language. For example, if we have python code for
windows and if we want to run this code on other platform such as Linux, Unix and Mac then
we do not need to change it, we can run this code on any platform.

8. Python is Integrated language:

Python is also an integrated language because we can easily integrated python with other
language like c, c++ etc.

9. Interpreted Language:

Python is an Interpreted Language. Because python code is executed line by line at a time.
Like other language c, c++, java etc. there is no need to compile python code this makes it
easier to debug our code. The source code of python is converted into an immediate form
called bytecode.

10. Large Standard Library:

Python has a large standard library which provides rich set of module and functions so you
do not have to write your own code for every single thing. There are many libraries present in
python for such as regular expressions, unit-testing, web browsers etc.

11. Dynamically Typed Language:

Python is dynamically-typed language. That means the type (for example- int, double, long
etc.) for a variable is decided at run time not in advance. Because of this feature we don’t
need to specify the type of variable.

11
3.4 Applications of Python

1. GUI-Based Desktop Applications:

Python has simple syntax, modular architecture, rich text processing tools and the ability to work
on multiple operating systems which make it a desirable choice for developing desktop- based
applications. There are various GUI toolkits like wxPython, PyQt or PyGtk available which help
developers create highly functional Graphical User Interface (GUI). The various applications
developed using Python includes:

 Image Processing and Graphic Design Applications:

Python has been used to make 2D imaging software such as Inkscape, GIMP, Paint Shop Pro
and Scribus. Further, 3D animation packages, like Blender, 3ds Max, Cinema 4D, Houdini,
Lightwave and Maya, also use Python in variable proportions.

 Scientific and Computational Applications:

The higher speeds, productivity and availability of tools, such as Scientific Python and
Numeric Python, have resulted in Python becoming an integral part of applications involved
in computation and processing of scientific data. 3D modelling software, such as Free CAD,
and finite element method software, such as Abaqus, are coded in Python.

 Games:

Python has various modules, libraries and platforms that support development of games. For
example, PySoy is a 3D game engine supporting Python 3, and PyGame provides
functionality and a library for game development. There have been numerous games built
using Python including Civilization-IV, Disney’s Toontown Online, Vega Strike etc.

2. Web Frameworks and Web Applications:

Python has been used to create a variety of web-frameworks including CherryPy, Django,
TurboGears, Bottle, Flask etc. These frameworks provide standard libraries and modules which
simplify tasks related to content management, interaction with database and interfacing with
12
different internet protocols such as HTTP, SMTP, XML-RPC, FTP and POP. Plone, a content
management system; ERP5, an open source ERP which is used in aerospace, apparel and
banking; Odoo – a consolidated suite of business applications; and Google App engine are a few
of the popular web applications based on Python.

3. Enterprise and Business Applications:

With features that include special libraries, extensibility, scalability and easily readable syntax,
Python is a suitable coding language for customizing larger applications. Reddit, which was
originally written in Common Lips, was rewritten in Python in 2005. Python also contributed in
a large part to functionality in YouTube.

4. Operating Systems:

Python is often an integral part of Linux distributions. For instance, Ubuntu’s Ubiquity Installer,
and Fedora’s and Red Hat Enterprise Linux’s Anaconda Installer are written in Python. Gentoo
Linux makes use of Python for Portage, its package management system.

5. Language Development:

Python’s design and module architecture has influenced development of numerous languages.
Boo language uses an object model, syntax and indentation, similar to Python. Further, syntax of
languages like Apple’s Swift, CoffeeScript, Cobra, and OCaml all share similarity with Python.

6. Prototyping:

Besides being quick and easy to learn, Python also has the open source advantage of being free
with the support of a large community. This makes it the preferred choice for prototype
development. Further, the agility, extensibility and scalability and ease of refactoring code
associated with Python allow faster development from initial prototype.

Since its origin in 1989, Python has grown to become part of a plethora of web-based, desktop-
based, graphic design, scientific, and computational applications. With Python available for
Windows, Mac OS X and Linux / UNIX, it offers ease of development for enterprises.

13
Additionally, the latest release Python 3.7.4 builds on the existing strengths of the language,
with drastic improvement in Unicode support, among other new features.

3.5 Installing Python

Step 1: Go to www.python.org

Click Python Download.

The following page will appear in your browser

Figure 8 www.python.org

Click the Download Python 3.7.0 button.

Step 2: Installing

Double-click the icon labeling the file python-3.7.0.exe.

An Open File - Security Warning pop-up window will appear.

14
Figure 9 run the python file

Click Run.

A Python 3.7.0 (32-bit) Setup pop-up window will appear.

Figure 10 installing python

Highlight the Install Now (or Upgrade Now) message, and then click it.

A User Account Conrol pop-up window will appear, posing the question Do you want
the allow the following program to make changes to this computer?
15
Figure 11 user access control

Click the Yes button.

A new Python 3.7.0 (32-bit) Setup pop-up window will appear with a Setup Progress
message and a progress bar.

Figure 12 installation in progress

During installation, it will show the various components it is installing and move the
progress bar towards completion. Soon, a new Python 3.7.0 (32-bit) Setup pop-up
window will appear with a Setup was successfully message.

16
Figure 13 Installed successfully

Click the Close button.

Python should now be installed.

17
Chapter 4

Python Basics

4.1 Keywords

Keywords are the reserved words in Python. We cannot use a keyword as variable name, function
name or any other identifier.

Table 1. Keywords

False True Finally try except


And Or For import break
Continue Elif If else pass
As Assert Del global from
Nonlocal Lambda Is in def
Not raise Return while with
Yield Class not

4.2 Python Identifiers

A Python identifier is a name used to identify a variable, function, class, module or other object.
An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more
letters, underscores and digits (0 to 9).

Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a
case sensitive programming language. Thus, Manpower and manpower are two different
identifiers in Python.

Here are naming conventions for Python identifiers −

 Class names start with an uppercase letter. All other identifiers start with a lowercase letter.
 Starting an identifier with a single leading underscore indicates that the identifier is private.
 Starting an identifier with two leading underscores indicates a strongly private identifier.
 If the identifier also ends with two trailing underscores, the identifier is a language-defined
special name.

18
4.3 Python Data Type

Python has many native datatypes. Here are the important ones:

 Booleans are either True or False.


 Numbers can be integers (1 and 2), floats (1.1 and 1.2), fractions (1/2 and 2/3), or even
complex numbers.
 Strings are sequences of Unicode characters, e.g. an html document.
 Bytes and byte arrays, e.g. a jpeg image file.
 Lists are ordered sequences of values.
 Tuples are ordered, immutable sequences of values.
 Sets are unordered bags of values.
 Dictionaries are unordered bags of key-value pairs.

4.3.1 String:

 String is collection data type.


 Python strings are immutable.
 Strings in Python are identified as a contiguous set of characters in between quotation
marks.
 Python allows for either pairs of single or double quotes. Triple quotes (three consecutive
single or double quotes) can be used to escape special characters.
 Subsets of strings can be taken using the index ( [ ] ) and slice ( [ : ] ) operators, which
work with indexes starting at 0 in the beginning of the string and working their way from
-1 at the end.

19
Table 2 Function on String

4.3.2 Python Tuple:

A Tuple is a collection of Python objects separated by commas. In someways a tuple is similar


to a list in terms of indexing, nested objects and repetition but a tuple is immutable unlike lists
which are mutable.

empty_tuple = ()

print (empty_tuple)

# Creating non-empty tuples

# One way of creation

tup = 'python', '3.7.4'

print(tup)

# Another for doing the same

tup = ('python', '3.7.4')


20
print(tup)

4.3.3 Python List:

Lists are just like the arrays, declared in other languages. Lists need not be homogeneous always
which makes it a most powerful tool in Python. A single list may contain data types like Integers,
Strings, as well as Objects. Lists are also very useful for implementing stacks and queues. Lists
are mutable, and hence, they can be altered even after their creation.

In Python, list is a type of container in Data Structures, which is used to store multiple data at the
same time. Unlike Sets, the list in Python are ordered and have a definite count. The elements in
a list are indexed according to a definite sequence and the indexing of a list is done with 0 being
the first index. Each element in the list has its definite place in the list, which allows duplicating
of elements in the list, with each element having its own distinct place and credibility.

List = []

# Creating a List with

# the use of a String

List = ['Python']

# Creating a List with

# the use of multiple values

List = ["Geeks", "For", "Geeks"]

List = [['programming', 'Language0'] , ['Python']]

List = [1, 2, 4, 4, 3, 3, 3, 6, 5]

List = [1, 2, 'Good', 4, 'deeds', 6, 'python']

Table 3. List Methods:

append(num) Used for appending and adding elements to List.It is used to add
elements to the last position of List.
insert(index,num) Inserts an elements at specified position.

21
Index(num) Returns the index of first occurrence. Start and End index are not
necessary parameters.
count(num) Calculates total occurrence of given element of List.
extend(list2) Adds contents to List2 to the end of List1
sort() Sort the given data structure (both tuple and list) in ascending order.
pop() Index is not a necessary parameter, if not mentioned takes the last index
and pop that number
Del Element to be deleted is mentioned using list name and index.
remove(): Element to be deleted is mentioned using list name and element.

4.3.4 Python Sets:

Set in Python is a data structure equivalent to sets in mathematics. It may consist of various
elements; the order of elements in a set is undefined. We can add and delete elements of a set,
you can iterate the elements of the set, perform standard operations on sets (union, intersection,
difference). Besides that, you can check if an element belongs to a set.

Any immutable data type can be an element of a set: a number, a string, a tuple. Mutable
(changeable) data types cannot be elements of the set. In particular, list cannot be an element of
a set (but tuple can), and another set cannot be an element of a set.

How To Define a Set in Python

A={1,2,3}

Or

A=set(1,2,3)

4.3.5 Python Dictionary:

Dictionary in Python is an unordered collection of data values, used to store data values like a
map, which unlike other Data Types that hold only single value as an element, Dictionary holds
key:value pair. Key value is provided in the dictionary to make it more optimized. Each key-
value pair in a Dictionary is separated by a colon :, whereas each key is separated by a ‘comma’.

22
A Dictionary in Python works similar to the Dictionary in a real world. Keys of a Dictionary
must be unique and of immutable data type such as Strings, Integers and tuples, but the key-
values can be repeated and be of any type.

# Creating an empty Dictionary

Dict = {}

# Creating a Dictionary

# with Integer Keys

Dict = {1: 'Python', 2: 'Is', 3: 'Language'}

# Creating a Dictionary

# with Mixed keys

Dict = {'Name': 'Dictionary', 1: [1, 2, 3, 4]}

# Creating a Dictionary

# with dict() method

Dict = dict({1: 'java', 2: 'python', 3:’C++’})

# Creating a Dictionary

# with each item as a Pair

Dict = dict([(1, 'Java'), (2, 'Python')])

4.4 Operators in Python:

4.4.1 Arithmetic Operators

Table 4 Arithmetic Operators

Operators Description
+ Addition Adds values on either side of the operator.

- Subtraction Subtracts right hand operand from left hand operand.

*Multiplication Multiplies values on either side of the operator

23
/ Division Divides left hand operand by right hand operand

% Modulus Divides left hand operand by right hand operand and returns remainder

** Exponent Performs exponential (power) calculation on operators

// Floor The division of operands where the result is the quotient in which the digits
Division after the decimal point are removed. But if one of the operands is negative, the
result is floored, i.e., rounded away from zero (towards negative infinity):

4.4.2 Bitwise Operator

Table 5 Bitwise operators:

Operators Description

& Binary AND Operator copies a bit, to the result, if it exists in both operands

| Binary OR It copies a bit, if it exists in either operand.

^ Binary XOR It copies the bit, if it is set in one operand but not both.

~ Binary Ones It is unary and has the effect of 'flipping' bits.


Complement

<< Binary Left Shift The left operand's value is moved left by the number of bits specified by the
right operand.

>> Binary Right Shift The left operand's value is moved right by the number of bits specified by the
right operand.

4.4.3 Logical Operators:

Table 6 Logical Operators

Operator Description

and Logical AND If both the operands are true then condition becomes true.

or Logical OR If any of the two operands are non-zero then condition becomes true.

not Logical NOT Used to reverse the logical state of its operand.

24
4.4.4 Membership Operators:

Table 7 Membership Operators

Operator Description Example

In Evaluates to true if it finds a variable in the specified x in y, here in results in a 1 if x


sequence and false otherwise. is a member of sequence y.

not in Evaluates to true if it does not finds a variable in the x not in y, here not in results in
specified sequence and false otherwise. a 1 if x is not a member of
sequence y.

4.4.5 Identity Operators:

Table 8 Identity Operators

Operator Description Example

Is Evaluates to true if the variables on either side of the x is y, here is results in 1


operator point to the same object and false otherwise. if id(x) equals id(y).

is not Evaluates to false if the variables on either side of the x is not y, here is
operator point to the same object and true otherwise. not results in 1 if id(x) is
not equal to id(y).

4.5 Decision Making Statements in Python

Decision making statements in programming languages decides the direction of flow of


program execution. Decision making statements available in python are:

1. if statement

2. if..else statements

3. nested if statements

4. if-elif ladder

1. If Statement:

Syntax

if condition:

25
# Statements to execute if

# condition is true

flow chart of if condition

2. If else Statement:

Syntax

if (condition):

# Executes this block if

# condition is true

else:

# Executes this block if

# condition is false

3.Nested if Statement:

Syntax

if (condition1):

26
# Executes when condition1 is true

if (condition2):

# Executes when condition2 is true

# if Block is end here

# if Block is end here

flow chart of nested if

4. If elif Statement:

Syntax

if (condition):

statement

elif (condition):

statement

27
.

else:

statement

Flow chart of if elif

4.6 Functions in Python

A function is a block of organized, reusable code that is used to perform a single, related action.
Functions provide better modularity for your application and a high degree of code reusing.

 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. You can
also define parameters inside these parentheses.

28
 The first statement of a function can be an optional statement - the documentation string
of the function or docstring.
 The code block within every function starts with a colon (:) and is indented.
 The statement return [expression] exits a function, optionally passing back an expression
to the caller. A return statement with no arguments is the same as return None.

Syntax

def functionname( parameters ):

"function_docstring"

function_suite

return [expression]

4.7 Classes in Python

Classes are a core part of object-oriented programming and serve as a "container" for related data
and logic. They provide a "blueprint" for creating "real" objects, called instances. Because Python
does not require you to program in an object-oriented way (like Java does), classes are not
required learning at this time.

4.7.1 How to Declare Classes

classClassName (base_class[es]):

"optional documentation string"

static_member_declarations

method_declarations

Classes are declared using the class keyword.

4.8 Modules

A module is a logical way to physically organize and distinguish related pieces of Python code
into individual files. A module can contain executable code, functions, classes, or any and all of
the above.When you create a Python source file, the name of the module is the same as the file
except without the trailing .py extension. Once a module is created, you may import that module
for use from another module using the import statement.

29
3.8.1 How to Import a Module

importmodule_name

3.8.2 How to Call a Module Function or Access a Module Variable

Once imported, a module's attributes (functions and variables) can be accessed using the
familiar dotted attribute notation:

module.function()

module.variable

4.9 Exceptions in Python

As you were going through some of the examples in the previous chapters, you no doubt noticed
what happens when your program "crashes" or terminates due to unresolved errors. A "traceback"
notice appears along with a notice containing as much diagnostic information as the interpreter
can give you, including the error name, reason, and perhaps even the line number near or exactly
where the error occurred. All errors have a similar format, regardless of whether running within
the Python interpreter or standard script execution, providing a consistent error interface. All
errors, whether they be syntactical or logical, result from behavior incompatible with the Python
interpreter and cause exceptions to be raised.

• NameError: attempt to access an undeclared variable

• ZeroDivisionError: division by any numeric zero

• SyntaxError: Python interpreter syntax error

• IndexError: request for an out-of-range index for sequence

• KeyError: request for a non-existent dictionary key

• IOError: input/output error

• AttributeError: attempt to access an unknown object attribute

4.9.1 Detecting and Handling Exceptions

There are two main forms of the TRy statement: TRy-except and try-finally. These statements
are mutually exclusive, meaning that you pick only one of them. A try statement can be
accompanied by one or more except clauses, exactly one finally clause, or a hybrid try-except-
finally combination.
30
Try:

try_suite # watch for exceptions here

exceptException[, reason]:

except_suite # exception-handling code

4.9.2 Raising Exceptions

The interpreter was responsible for raising all of the exceptions we have seen so far. These exist
as a result of encountering an error during execution. A programmer writing an API may also
wish to throw an exception on erroneous input, for example, so Python provides a mechanism
for the programmer to explicitly generate an exception: the raise statement.

raise statement

The raise statement is quite flexible with the arguments it supports, translating to a large number
of different formats supported syntactically. The general syntax for raise is:

raise [SomeException [, args [, traceback]]]

31
Conclusion
The internship has been a really useful experience for me that I can learn a lot of new knowledge
that will definitely be useful for my future study. I am grateful that my assignments have a lot of
variety instead of just focussing on specific area. This allows me to be able to learn more and
also challenged myself to overcome many different kinds of difficulties encounter during my
internship.

Beside technical skill I also observe and learned a lot of soft skills from my supervisor and my
co-workers such as professional communication and teamwork.

My internship experience has definitely improve my hardskills in programming and sharper my


soft skills a lot more than I expected.

32

You might also like