Lect - 1 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

INT108

Python Programming

Assistant Professor
School of Computer Science and Engineering
Objectives
• What is Python?
• Why to learn Python
• Applications of Python
• History of Python
• Python Versions
• Installation of Python
What is Python?

• Python is a very popular general-purpose


interpreted, interactive, object-oriented, and high-
level programming language.
What is Python?

• 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.
Why to Learn Python?

• Python is consistently rated as one of the world's most popular


programming languages.
• Python is Open Source which means its available free of cost.
• Python is simple and so easy to learn
• Python is versatile and can be used to create many different
things.
• Python has powerful development libraries include AI, ML etc.
• Python is much in demand and ensures high salary
Applications of Python

• 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.
Applications of Python
• 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 scripti
Careers with Python

• If you know Python nicely, then you have a great career ahead. Here are just a few
of the career options where Python is a key skill:
• Game developer
• Web designer
• Python developer
• Full-stack developer
• Machine learning engineer
• Data scientist
• Data analyst
• Data engineer
• DevOps engineer
• Software engineer
• Many more other roles
Companies

• Python is very high in demand and all the major companies are looking for
great Python Programmers
• Google
• Intel
• NASA
• PayPal
• Facebook
• IBM
• Amazon
• Netflix
• Pinterest
• Uber
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, and 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 Versions
Guido Van Rossum published the first version of Python code (Python 0.9.0) at alt.sources in
February 1991. This release included exception handling, functions and the core data types.
● Python 1.0 released in January 1994. It included filters, map, reduce and lambda.
● Python 2.0 released in October 2000. Features include list comprehension and garbage
collection with reference cycles.
● Python 3.0 released in December 2008. This release removed duplicate constructs and modules,
but it was not backward compatible with previous versions..
● Do not panic. The features mentioned above will be discussed in detail in the later sections.
● Python can be used for creating computer applications, computer games or even for testing
microchips.
Program Life Cycle

● The instructions (called source code) written in Python


programming language can be executed in two modes:
● Interactive mode: In this mode, lines of code are directly written
and executed in the Python interpreter shell, which
instantaneously provides the results.
● Normal or script mode: In this mode the source code is saved to a
file with .py extension, and the file is executed by the Python
interpreter.
Program Life Cycle
• As we learn Python in this course, we'll use the regular way of
running code, which means writing our code in files with a .py
ending. This is the practice adopted for building extensive
programs in Python.
• For example, calculator.py is called a Python source file.
• The Python program statements have to be entered and saved in
a file through a text editor, and then the file has to be executed to
produce results.

• If there are any errors in Python code then the system will let you
know so that you can fix them.
Program Errors
• There are two types of errors:
• Syntax errors
• Runtime errors.

• Syntax errors are like grammatical errors in English. They occur


when the defined rules are not followed.
For example:
prin("Hello World")

• The Python interpreter generates the following syntax error as it


did not find a name prin (as the correct method name is print).
Program Errors
• Runtime errors occur due to incorrect algorithm/logic or wrong
operations like dividing by zero during the program execution.
For example:
a = 10
b=0
print(a / b)
• The Python interpreter generates the following runtime error
indicating that division by zero occurred during execution.
Installation of Python

• Install VS Code : https://code.visualstudio.com/download


• InstallPython:
https://www.python.org/downloads/release/python-3113/
• Create new folder .
• Open the folder and press Shift + Right click
• Select open window power shell and Type code .
Thank You

You might also like