Introduction to Python
Programming
What is Python?
• Python is a very popular general-purpose interpreted,
interactive, object-oriented, and high-level programming
language.
• It was created by Guido van Rossum during 1985- 1990.
What is Python?
• An interpreter is a program that executes the programming code directly
instead of just translating it into another format. It translates and
executes programming language statements one by one.
What is Python?
• Interactive programming, also known as live coding,
refers to any computer programming language that
allows the creator to make changes to the program while
it is already running.
• With interactive programming, the designer can make
changes to the code without having to run the program
over again
What is Python?
Python Execution process
What is Python?
• Python is dynamically-typed and garbage-collected
programming language.
• In dynamically-typed languages type checking is performed
at runtime. (In statically typed the type of a variable is known
at compile time.)
• // Java example // Python example
int num; num = 5
num = 5; (Here type is determined during
run time)
What is Python?
• A garbage collected (GC) programming language
includes one or more garbage collectors (GC engines)
that automatically free up memory space that has been
allocated to objects no longer needed by the program.
• The reclaimed memory space can then be used for future
object allocations within that program.
• It frees up developers from having to manually manage
a program's memory. (E.g. : C# and Java)
What is Python?
• Note : Python supports multiple programming
paradigms, including Procedural, Object Oriented and
Functional programming language.
• Today, Python is very high in demand and all the major
companies are looking for great Python Programmers to
develop websites, software components, and
applications or to work with Data Science, AI, and ML
technologies.
Why to Learn Python?
• Python is consistently rated as one of the world's most popular
programming languages. Python is fairly easy to learn.
• There are many other good reasons which makes Python as the
top choice of any programmer:
1. Python is Open Source which means its available free of cost.
2. Python is simple and so easy to learn
3. Python is versatile and can be used to create many different things.
4. Python has powerful development libraries include AI, ML etc.
5. Python is much in demand
Key advantages of learning Python
• Python is Interpreted − Python is processed at runtime by the
interpreter. You do not need to compile your program before executing it.
• 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.
Careers with Python
• 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
Characteristics of Python
• 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.
Other Important Features of Python
• Python works on different platforms (Windows, Mac, Linux,
Raspberry Pi, etc).
• Python has a simple syntax similar to the English language.
• Python has syntax that allows developers to write programs
with fewer lines than some other programming languages.
• Python runs on an interpreter system, meaning that code can be
executed as soon as it is written. This means that prototyping
can be very quick.
• Python provides interfaces to all major commercial databases.
Other Important Features of Python
• Python supports GUI applications that can be created and
ported to many system calls, libraries and windows systems
• Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.
Python Syntax compared to other
programming languages
• Python was designed for readability, and has some similarities to the
English language.
• Python uses new lines to complete a command, as opposed to other
programming languages which often use semicolons or parentheses.
• Python relies on indentation, using whitespace, to define scope; such
as the scope of loops, functions and classes. Other programming
languages often use curly-brackets for this purpose.
Good to Know
• The most recent major version of Python is Python 3
• Python can be written in a text editor. It is possible to write
Python in an Integrated Development Environment, such as
Thonny, IDLE, Pycharm, NetBeans, Visual Studio or Eclipse
which are particularly useful when managing larger collections
of Python files.
Installation
• To check if you have python installed on a Windows PC/Linux or
Mac, open terminal/command prompt and run the following on
the Command Line (cmd.exe)
• If you find that you do not have Python installed on your
computer, then you can download it for free from the following
website: https://www.python.org/
Python running
• Python is an interpreted programming language, this
means that as a developer you write Python (.py) files in a
text editor and then put those files into the python
interpreter to be executed.
• The way to run a python file is like this on the command
line:
Python running
• The Python Command Line(Interactive mode)
• To test a short amount of code in python sometimes it is quickest
and easiest not to write the code in a file. This is made possible
because Python can be run as a command line itself.
• Type the following on the Windows, Mac or Linux command line:
Python running
• The Python Command Line(Interactive mode)
• Which will write "Hello, World!" in the command line:
• Whenever you are done in the python command line, you can simply
type the following to quit the python command line interface: