You are on page 1of 12

Introduction to Python

Rincy T A
Assistant Professor
Prajyoti Niketan College, Pudukad

Python Programming Prajyoti Niketan College, Pudukad


Introduction
• High-level
• Interpreted
• General purpose
• Dynamic
• Reusable
• Widely used

Python Programming Prajyoti Niketan College, Pudukad


It is used for:

• web development (server-side)


• software development
• mathematics
• system scripting

Python Programming Prajyoti Niketan College, Pudukad


Why 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 can be treated in a procedural way, an
object-orientated way or a functional way.

Python Programming Prajyoti Niketan College, Pudukad


Key features
• Automatically compiled to byte code and
executed
• Has many built-in data types
• Supports many control statements
• Allows easier programming
• Supports functions, classes, modules and
packages

Python Programming Prajyoti Niketan College, Pudukad


Getting started with Python
• There are three different ways of starting
Python:
– Running a script written in python with a text
editor
– Using a GUI application from an IDLE; one that
comes with the Python installer itself
– Employing an interactive approach; with a
command line interpreter

Python Programming Prajyoti Niketan College, Pudukad


Good to know

• The most recent major version of Python is


Python 3. However, Python 2, although not being
updated with anything other than security
updates, is still quite popular.
• It is possible to write Python in an Integrated
Development Environment, such as PyCharm or
Eclipse which are particularly useful when
managing larger collections of Python files.
• Python Installer can be downloaded from
https://www.Python.org/downloads/

Python Programming Prajyoti Niketan College, Pudukad


Comments
• Comments are used by the programmer to
explain the piece of code to others as well as
to himself in a simple language.
• Hash Mark(#) is used for commenting in
Python

Python Programming Prajyoti Niketan College, Pudukad


Identifiers
• A python identifier is the name given to a
variable, function, class, module or other
object.
• Begin with an alphabet or underscore
• Can include any number of letters, digits or
underscores.
• Spaces are not allowed
• Case-sensitive

Python Programming Prajyoti Niketan College, Pudukad


• Hello and hello are different
• Examples
MyName
My_Name
Your_Name
Invalid Identifiers:
My Name
3dfig
Your#Name

Python Programming Prajyoti Niketan College, Pudukad


Keywords
• Reserved words with specific purpose and use
• Examples:
break else import return True
while with

Python Programming Prajyoti Niketan College, Pudukad


Variables
• It holds a value that may change
• No need to declare
• Instead initialise the variable
• Syntax
variable=expression

Python Programming Prajyoti Niketan College, Pudukad

You might also like