0% found this document useful (0 votes)
28 views3 pages

1.1 Introduction

The document provides an overview of Python programming, covering its constructs, features, and comparisons between compilers and interpreters. Python is described as a high-level, general-purpose, and object-oriented language that is easy to learn and portable across different platforms. It emphasizes Python's interactive nature, extensive libraries, and dynamic typing, making it suitable for a wide range of applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

1.1 Introduction

The document provides an overview of Python programming, covering its constructs, features, and comparisons between compilers and interpreters. Python is described as a high-level, general-purpose, and object-oriented language that is easy to learn and portable across different platforms. It emphasizes Python's interactive nature, extensive libraries, and dynamic typing, making it suitable for a wide range of applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

U23CS382-PYTHON PROGRAMMING

Unit I

PYTHON CONSTRUCTS

Introduction: Python Interpreter and interactive mode, Comments, Identifiers and Keywords; Data
Types; Variables and Expressions; Operators; Conditional Statements; Looping Statements; Fruitful
Functions; Lambda Function
Illustrative Programs: Financial application, sandwich vowel , and Chocolate Distribution
Algorithm

Introduction to Python
❖ Python is a widely used general-purpose, high-level, interpreted, interactive,

object oriented and reliable programming language.

❖ It was created by Guido van Rossum, and released in 1991.

❖ Python got its name from a BBC comedy series from seventies- “Monty Python’s
Flying Circus”.

❖ Python has a simple syntax similar to the English language.

❖ Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).

❖ It has vast library of modules to support integration of complex solutions from pre
built components.

Features of Python

a) General purpose language


❖ It can be used to write code for any task.

❖ Nowadays, it is used in Google, NASA, and New York stock exchange.

b) Easy-to-Learn
❖ A Python program is clearly defined and easily readable.

❖ The structure of the program is very simple.

❖ It uses few keywords and clearly defined syntax.


❖ This makes it easy for just anyone to pick up the language quickly.
c) High-level language
❖ When writing programs in python, the programmers don’t have to worry about the
low-level details like memory used by the program, etc.

❖ They just need to concentrate on solutions of the current problem at hand.

d) Interactive

❖ Programs in python work in interactive mode which allows interactive debugging


and testing of pieces of code.

❖ Programmers can easily interact with the interpreter directly at the python prompt

to write their programs.


e) Open source
❖ Python is publicly available open source software.

f) Portable

❖ High level languages are portable which means they are able to run across all

major hardware and software platforms with few or no change in source code. g)
Interpreted

❖ Python programs are interpreted, i.e., the interpreter takes the source code as input,
(to portable byte-code) one statement at a time and executes it immediately. There is no
need for compiling and linking.
h) Object Oriented

❖ Python supports both Procedure-Oriented and Object-Oriented Programming


(OOP) approaches.

❖ In procedure-oriented language, the program is built around procedures


(functions).

❖ In object-oriented languages, the program is built around objects which combines


data and functionality.

❖ When compared to other languages like Java or C++, Python is the simplest object
oriented programming language available today.
i) Embeddable
❖ Programmers can embed python within their C, C++, COM, ActiveX, CORBA
and Java programs to give ‘scripting’ capabilities for users.

j) Extensive libraries
❖ Python has a huge library that is easily portable across different platforms.

❖ These library functions are compatible on UNIX, Windows, Macintosh, etc. and
allows programmers to perform wide range of applications varying from text processing,
maintaining databases, to GUI Programming.
k) Dynamically types

❖ Python is a dynamically typed language, which means there is no need to declare


variables explicitly.

❖ Programs run immediately without taking much time to link and compile.

Compiler vs. Interpreter


Compiler Interpreter

Scans the entire program and translates it as Translates one statement at a time
a whole into machine code

It takes large amount of time to analyze It takes less amount of time to analyze the
the source code but the overall execution source code but the overall execution time is
time is comparatively faster slower

Generates intermediate object code which No intermediate object code is generated,


further requires linking, hence requires more hence memory is efficient
memory

It generates error message only after scanning Continues translating the program until the
the whole program, Hence debugging is first error is met, in which case it stops.
comparatively hard Hence debugging is easy.

Programming languages such as C and C++ Programming languages such as Python


use compilers and Ruby use interpreters

You might also like