PYTHO
N
PROGRAMMING
OBJECTIVES:
•To know what is Python Programming
and who created it
•Advantages of Python
•To know how to install Python App
• To know the basic python syntax rules
Python is considered as
one of the most
versatile programming
PYTHON
PROGRAMMING
languages.
Python is a popular
programming language
It is used for:
• web development (server-side),
• software development,
• mathematics,
• system scripting.
• It was first released on February 20, 1991.
Advantages of Python
• Python is Interactive: You can actually sit at a Python prompt and
interact with the interpreter directly to write your programs.
• Python is Interpreted: Python is processed at runtime by the
interpreter. You do not need to compile your program before executing it.
• 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 an excellent 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.
Installing Python
Windows Installation
•Here are the steps to install Python on Windows machine.
•Open a Web browser and go
to [Link]
•Download the Python 3.14
•Run the downloaded file. This brings up the Python install wizard,
which is really easy to use. Just accept the default settings, wait
until the install is finished, and you are done.
Python shell for instant calculations
Python script for coding
How to Run
Output
Python Engine for Mobile Phone
•In our case, when the students do not have their own laptop or
desktop, your mobile phone with QPython and Pydroid are
recommended for you to perform your laboratory exercises.
• QPython is the Python engine for android which contains some
amazing features such as Python interpreter, runtime environment
and editor.
• It makes it easy for you to use Python on Android and also it is
open source or free. All you need to do is to download it in
[Link]
y3
1. Python is case sensitive.
Thus, Manpower and manpower are two
different identifiers in Python.
2. For path specification, python uses forward
slashes. For window's path
C:\folderA\folderB relative python program
PYTHON
PROGRAMMING
path should be C:/folderA/folder
PYTHON SYNTAX 3. In python, there is no command terminator,
which means no semicolon ; or anything, So
RULES if you want to print something as output, all
you have to do is:
print ("Hello, World!")
4. In one line only a single executable
statement should be written and the line
change act as command terminator in python.
To write two separate executable statements
in a single line, you should use a semicolon ;
to separate the commands. For example,
PYTHON
PROGRAMMING
5. In python, you can use single quotes ‘ ‘ ,
PYTHON SYNTAX double quotes “ “ and even triple quotes ''' """
RULES to represent string literals.
6. In python, you can write comments in your
program using a # at the start. A comment is
ignored while the python script is executed.
PYTHON
PROGRAMMING
7. Line Continuation: To write a code in
PYTHON SYNTAX multiline without confusing the python
interpreter, is by using a backslash \ at the
RULES end of each line to explicitly denote line
continuation. For example,
8. Expressions enclosed in ( ), [ ] or { }
brackets don't need a backward slash for line
continuation. For example,
PYTHON
PROGRAMMING
9. Blank lines in between a program are
PYTHON SYNTAX ignored by python.
RULES
10. Code Indentation: This is the most important rule
of python programming. In programming language
like Java, C or C++, generally curly brackets { } are
used to define a code block, but python doesn't use
brackets, then how does python knows where a
particular code block ends. Well python used
indentation for this.
It is recommended to use tab for indentation, although
PYTHON
PROGRAMMING
you can use spaces for indentation as well, just keep
in mind that the amount of indentation for a single
code block should be same.
PYTHON SYNTAX
RULES
the correct way would be,
Also, the following code will give error, as the
statements are differently indented:
PYTHON
PROGRAMMING
PYTHON SYNTAX
RULES again, the correct way to do so is to keep all the
statements of a particular code block at same
indentation.
END OF SLIDE
PROGRAMMING