SlideShare a Scribd company logo
PYTHON PROGRAMMING
T.Y.BSC(CS) SEM-V
[COURSE CODE VS 3510: Credits-2]
By- Prof. Sangeeta M. Borde (Computer Science Department)
SUBJECT SYLLABUS
Chapter 1: An Introduction to Python
▪ Introduction to Python
▪ The Python Programming Language
▪ History of the Language, features Applications
▪ Installing Python, Running Simple Python program Basics of Python Standard data types
- basic, none, Boolean (true & False), numbers, Variables, Constants
▪ Python identifiers and reserved words,
▪ Lines and indentation,
▪ multi-line statements and Comments,
▪ Input/output with print and input ,functions Declaration,
▪ Operations on Data such as assignment, arithmetic, relational, logical and bitwise
operations, dry run, Simple Input and output etc.
SUBJECT SYLLABUS Continue…
Chapter 2: Control Statements
Sequence Control – Precedence of operators
Type conversion Conditional Statements: if, if-else, nested if-else, Looping- for, while,
nested loops, loop control statements (break, continue, pass).
Strings: declaration, manipulation, special operations, escape character, string formatting
operator, Raw String, Unicode strings, Built-in String methods.
Chapter 3 Lists, functions, tuples and dictionaries, Sets
Python Lists: Concept, creating and accessing elements, updating & deleting lists, traversing a List,
reverse Built-in List Operators,
Concatenation, Repetition, In Operator, Built-in List functions and methods. Functions: Definitions and
Uses, Function Calls, Type Conversion Functions, Math Functions, Composition, Adding New Functions,
Flow of Execution, Parameters and Arguments, Variables and Parameters, Stack Diagrams,
Void Functions, Anonymous functions Importing with from, Return Values, Boolean Functions,
More Recursion, Functional programming tools - filter(), map(), and reduce(),recursion, lambda forms.
SUBJECT SYLLABUS Continue…
Chapter 3:
Lists, functions, tuples and dictionaries, Sets
Continue…
Tuples and Dictionaries: Tuples, Accessing values in Tuples, Tuple Assignment,
Tuples as return values, Variable-length argument tuples, and Basic tuples
operations, Concatenation, Repetition, in Operator, Iteration, Built-in tuple functions,
indexing, slicing and matrices.
Creating a Dictionary, Accessing Values in a dictionary, Updating Dictionary,
Deleting Elements from Dictionary, Properties of Dictionary keys, Operations in
Dictionary, Built-In Dictionary Functions, Built-in Dictionary Methods.
Sets- Definition, transaction of set(Adding, Union, intersection), working with sets
SUBJECT SYLLABUS Continue…
▪ Chapter 4 Modules ,Working with files, Exception
handling
▪ Modules: Importing module, Creating & exploring modules, Math module,
Random module, Time module Packages: Importing package, creating package,
examples
▪ Working with files: Creating files and Operations on files (open, close, read,
write), File object attributes, file positions, Listing Files in a Directory, Testing File
Types, Removing files and directories, copying and renaming files, splitting
pathnames, creating and moving directories
▪ Regular Expression: Concept of regular expression, various types of regular
expressions, using match function.
▪ Exception Handling: Built-in Exceptions, Handling Exceptions, Exception with
Arguments, User-defined Exceptions.
SUBJECT SYLLABUS Continue…
▪ Chapter 4 Modules ,Working with files, Exception
handling
▪ Modules: Importing module, Creating & exploring modules, Math module,
Random module, Time module Packages: Importing package, creating package,
examples
▪ Working with files: Creating files and Operations on files (open, close, read,
write), File object attributes, file positions, Listing Files in a Directory, Testing File
Types, Removing files and directories, copying and renaming files, splitting
pathnames, creating and moving directories
▪ Regular Expression: Concept of regular expression, various types of regular
expressions, using match function.
▪ Exception Handling: Built-in Exceptions, Handling Exceptions, Exception with
Arguments, User-defined Exceptions.
SUBJECT SYLLABUS Continue…
Programming Assignments
▪ Assignment 1 - Python Basics
▪ Assignment 2 – Arrays, Strings, and Functions Assignment 3 - List, Tuples, Sets, and Dictionary
▪ Assignment 4 - File Handling and Date-Time
▪ Assignment 5 - Exception handling and Regular expression
Reference Books:
▪ 1. An Introduction to Computer Science using Python 3 by Jason Montojo, Jennifer Campbell, Paul Gries, The
pragmatic bookshelf-2013
▪ 2. James Payne, “Beginning Python: Using Python and Python 3.1,Wrox Publication
▪ 3. Introduction to Computer Science Using Python- Charles Dierbach, Wiley Publication Learning with Python
“, Green Tea Press, 2002
▪ 4. Introduction to Problem Solving with Python by E balguruswamy,TMH publication- 2016
▪ 5. Beginning Programming with Python for Dummies Paperback – 2015 by John Paul Mueller
▪ 6. Object-oriented Programming in Python, Michael H. Goldwasser, David Letscher, Pearson Prentice Hall-
2008
CH.1 INTRODUCTION TO
PYTHON (3)
INTRODUCTION:
What is Python Programming
Language?
▪ Python is an object-oriented
programming language created by
Guido Rossum in 1989. It is ideally
designed for rapid prototyping of
complex applications.
▪ It has interfaces to many OS
system calls and libraries and is
extensible to C or C++.
▪ Many large companies use the
Python programming language,
including NASA, Google, YouTube,
BitTorrent, etc.
Applications of Python
Programming:
1. Web Applications.
2. GUI based desktop Applications.
3. Scientific and Numeric Applications.
4. Software Development.
5. Business Applications.
6. Console based Applications.
7. Audio or Video based Applications.
8. 3D CAD Applications.
9. Enterprise Applications.
10. Applications for images.
11. Education.
About Python Programming Language:
▪ Python is a high-level, interpreted, interactive and object-oriented scripting
language. Python is designed to be highly readable. It uses English keywords
frequently whereas the other languages use punctuations. It has fewer syntactical
constructions than other languages.
▪ 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.
Python's features:
▪ Python's features include-
▪ Easy-to-learn: Python has few keywords, simple structure, and a clearly defined
syntax. This allows a 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.
▪ 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.
Python's features: continue…
▪ 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 scripting. Apart from the above-mentioned features, Python has a big list of good
features.
▪ A few are listed below-
▪ 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.
PYTHON PROGRAMMING LANGUAGE
Installing Python
Python editors for doing python programming:
▪ IDLE
▪ PyCharm
▪ Spyder
▪ PyDev
▪ Jupiter Notebook.
Python Basic Modes:
▪ Interactive Mode: Sybmol-- “>>>”
▪ It means ready to accept interactive commands.
▪ For Ex: >>> print(“interactive mode”)
▪ Script Mode:
File->New File to open blank script to write the code. Then save the script with .py
extension.
To run the script, Select Run->”Run Module”
BASICS OF PYTHON
CONTENTS OVERVIEW
▪ Standard datatypes
▪ Variables
▪ Constants
▪ Identifiers
▪ Reserved Words
▪ Lines, Indentation and Multiline Statements
▪ Input Output Functions
▪ Operations on Data Using Operators
Structure of Python Program-
Documentation Section
Import Statement
Global Declaration Section
Class Section
Subprogram Section
Play Ground Section
Data Members
Members Functions
Optional
Essential
STANDARD DATA TYPES
LIST OF DATA TYPES USED IN PYTHON PROGRAMMING LANGUAGE:
1.Numbers—Integers, floats, fractions, Complex Numbers
2.Strings—Text characters, special symbols or Alphanumeric data
3.List—Sequential data
4.Tuple—like list with little difference.
5.Dictionary—Unordered collection of key value pairs.
6.Boolean– The simplest build-in type in python is the bool data type, it represents
the two values, True and False.
7.None-Python defines a special variable None denoting a “Null object". None in
python is used for defining null variables and objects.
2 ] Variables
▪ Variable is like a container that stores values that we can access or change. It is a
way of pointing to a memory location used by a program.
▪ Syntax : variable=value
3] Constants
A constant is a type of variable whose value cannot be changed during the
execution of program. constants are usually declared and assigned in a module.
For eg: PI=3.14
4] Literals in python
5] Identifiers
6] Reserved words eg: and,as ,assert,break 7] Comments eg: #
Input / Output Functions:
▪ Input function helps to enter data at run time by the user and the output function.
▪ Input() : Input function reads a line of input from the keyboard. In python input() is
used to take input from user.
▪ Syntax:- variable_name=input() //withput argument
▪ Variable_name=input(‘string’) //with argument
▪ Operations on Data using Operators
1. Unary 5.Bitwise operators
2. Binary 6.Relational or comparison operators
3. Arithmetic Operators 7.Identity operators
4. Logical 8.Membership operators
INPUT AND OUTPUT FUNCTION
▪ Input(): reads a line of input from the keyboard. In python, input() function is used
to take the input from the user.
▪ Print(): print() function is used to output data to the standard output device.
▪ Syntax: input()-input(“string”)
▪ print()---print(“string”)
PRECEDENCE AND ASSOCIATIVITY OF
OPERATORS IN PYTHON
11-NOV-2021
The operator precedence in Python is listed in the following table. It is
in descending order (upper group has higher precedence than the
lower ones).
Operators Meaning
() Parentheses
** Exponent
+x, -x, ~x Unary plus, Unary minus, Bitwise NOT
*, /, //, % Multiplication, Division, Floor division, Modulus
+, - Addition, Subtraction
<<, >> Bitwise shift operators
& Bitwise AND
^ Bitwise XOR
| Bitwise OR
==, !=, >, >=, <, <=, is, is not, in, not in Comparisons, Identity, Membership operators
not Logical NOT
and Logical AND
or Logical OR
Standard Data Types
▪ Dictionary Data Type:
▪ Represents a collection of data that associate a unique key with each value.
▪ SETS: A set is an unordered collection of items. Every element is unique(no
duplicates) and must be immutable(which can not be changed.
CH.2 CONTROL STATEMENTS
▪ 1.TYPE CONVERSION
▪ 2.CONDITIONAL STATEMENTS
1. If statement:
If condition:
statements(s)
2. If else statement:
If condition:
statement(s)
else:
statement(s)
CH.2 CONTROL STATEMENTS
▪ 3. if elif else statement:
If(condition 1):
statements
elif(condition 2):
statements
…..
elif(condition-n)
Statements
else:
statements
CH.2 CONTROL STATEMENTS continue…
Nested if statement:
▪ Syntax:
▪ If condition1:
If condition2:
statement1
else:
statement2
else:
statement3
.
LOOPING:
▪ While Loop:
Syntax:
while condition:
statement(s)
CH.2 CONTROL STATEMENTS continue…
▪ For Loop:
▪ For iterating_var in sequence :
▪ Statement(s)
Loop Control Statements:
▪ 1.break
▪ 2. continue
▪ 3.pass

More Related Content

PPTX
Python basics
PDF
Tutorial on-python-programming
PDF
First Steps in Python Programming
PDF
From Basics to Advanced: A Comprehensive Python Programming Guide
PPTX
Introduction-to-Python-Programming1.pptx
PDF
Introduction of Python
PDF
GE3151_PSPP_UNIT_2_Notes
PPTX
PERSENTATION-ONPYTHON 2025 updated python.pptx
Python basics
Tutorial on-python-programming
First Steps in Python Programming
From Basics to Advanced: A Comprehensive Python Programming Guide
Introduction-to-Python-Programming1.pptx
Introduction of Python
GE3151_PSPP_UNIT_2_Notes
PERSENTATION-ONPYTHON 2025 updated python.pptx

Similar to 2024-25 TYBSC(CS)-PYTHON_PROG_ControlStructure.pptx (20)

PDF
introduction of python in data science
PPTX
4_Introduction to Python Programming.pptx
PDF
summer t.pdf
PPT
FALLSEM2022-23_ITA3007_ETH_VL2022230100613_Reference_Material_I_23-09-2022_py...
PPTX
Lecture on Fundamentals of Python Programming-1
PDF
Python final ppt
PDF
Pythonfinalppt 170822121204
PPTX
python presntation 2.pptx
PPTX
Python introduction towards data science
PPTX
Chapter 2: Basics of programming pyton programming
PPTX
Introduction to python programming ( part-1)
PPTX
Introduction to Programming.pptx ok ok ok
PPT
python introduction all the students.ppt
PPT
Pythonintroduction
PPTX
python programming ppt-230111072927-1c7002a5.pptx
PPTX
Python PPT by Sushil Sir.pptx
PDF
web programming UNIT VIII python by Bhavsingh Maloth
PPTX
cupdf.com_python-seminar-ppt.pptx.........
introduction of python in data science
4_Introduction to Python Programming.pptx
summer t.pdf
FALLSEM2022-23_ITA3007_ETH_VL2022230100613_Reference_Material_I_23-09-2022_py...
Lecture on Fundamentals of Python Programming-1
Python final ppt
Pythonfinalppt 170822121204
python presntation 2.pptx
Python introduction towards data science
Chapter 2: Basics of programming pyton programming
Introduction to python programming ( part-1)
Introduction to Programming.pptx ok ok ok
python introduction all the students.ppt
Pythonintroduction
python programming ppt-230111072927-1c7002a5.pptx
Python PPT by Sushil Sir.pptx
web programming UNIT VIII python by Bhavsingh Maloth
cupdf.com_python-seminar-ppt.pptx.........
Ad

More from sangeeta borde (11)

PPTX
CH 4_TYBSC(CS)_Data Science_Visualisation
PDF
Ch.3 Data Science Data Preprocessing.pdf
PDF
Data Science_Chapter -2_Statical Data Analysis.pdf
PPTX
Ch1_Introduction to DATA SCIENCE_TYBSC(CS)_2024.pptx
PDF
Advance C Programming UNIT 4-FILE HANDLING IN C.pdf
PPTX
CH2_CYBER_SECURITY_FYMSC(DS)-MSC(CS)-MSC(IMCA).pptx
PPTX
FYBSC(CS)_UNIT-1_Pointers in C.pptx
PPTX
UNIT-5_Array in c_part1.pptx
PPTX
CH.4FUNCTIONS IN C (1).pptx
PDF
3. Test Scenarios & Test Cases with Excel Sheet Format (1).pdf
PPTX
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
CH 4_TYBSC(CS)_Data Science_Visualisation
Ch.3 Data Science Data Preprocessing.pdf
Data Science_Chapter -2_Statical Data Analysis.pdf
Ch1_Introduction to DATA SCIENCE_TYBSC(CS)_2024.pptx
Advance C Programming UNIT 4-FILE HANDLING IN C.pdf
CH2_CYBER_SECURITY_FYMSC(DS)-MSC(CS)-MSC(IMCA).pptx
FYBSC(CS)_UNIT-1_Pointers in C.pptx
UNIT-5_Array in c_part1.pptx
CH.4FUNCTIONS IN C (1).pptx
3. Test Scenarios & Test Cases with Excel Sheet Format (1).pdf
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
Ad

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
KodekX | Application Modernization Development
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Cloud computing and distributed systems.
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPT
Teaching material agriculture food technology
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Weekly Chronicles - August'25 Week I
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KodekX | Application Modernization Development
The Rise and Fall of 3GPP – Time for a Sabbatical?
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Review of recent advances in non-invasive hemoglobin estimation
Per capita expenditure prediction using model stacking based on satellite ima...
Reach Out and Touch Someone: Haptics and Empathic Computing
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Building Integrated photovoltaic BIPV_UPV.pdf
Cloud computing and distributed systems.
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Teaching material agriculture food technology
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

2024-25 TYBSC(CS)-PYTHON_PROG_ControlStructure.pptx

  • 1. PYTHON PROGRAMMING T.Y.BSC(CS) SEM-V [COURSE CODE VS 3510: Credits-2] By- Prof. Sangeeta M. Borde (Computer Science Department)
  • 2. SUBJECT SYLLABUS Chapter 1: An Introduction to Python ▪ Introduction to Python ▪ The Python Programming Language ▪ History of the Language, features Applications ▪ Installing Python, Running Simple Python program Basics of Python Standard data types - basic, none, Boolean (true & False), numbers, Variables, Constants ▪ Python identifiers and reserved words, ▪ Lines and indentation, ▪ multi-line statements and Comments, ▪ Input/output with print and input ,functions Declaration, ▪ Operations on Data such as assignment, arithmetic, relational, logical and bitwise operations, dry run, Simple Input and output etc.
  • 3. SUBJECT SYLLABUS Continue… Chapter 2: Control Statements Sequence Control – Precedence of operators Type conversion Conditional Statements: if, if-else, nested if-else, Looping- for, while, nested loops, loop control statements (break, continue, pass). Strings: declaration, manipulation, special operations, escape character, string formatting operator, Raw String, Unicode strings, Built-in String methods. Chapter 3 Lists, functions, tuples and dictionaries, Sets Python Lists: Concept, creating and accessing elements, updating & deleting lists, traversing a List, reverse Built-in List Operators, Concatenation, Repetition, In Operator, Built-in List functions and methods. Functions: Definitions and Uses, Function Calls, Type Conversion Functions, Math Functions, Composition, Adding New Functions, Flow of Execution, Parameters and Arguments, Variables and Parameters, Stack Diagrams, Void Functions, Anonymous functions Importing with from, Return Values, Boolean Functions, More Recursion, Functional programming tools - filter(), map(), and reduce(),recursion, lambda forms.
  • 4. SUBJECT SYLLABUS Continue… Chapter 3: Lists, functions, tuples and dictionaries, Sets Continue… Tuples and Dictionaries: Tuples, Accessing values in Tuples, Tuple Assignment, Tuples as return values, Variable-length argument tuples, and Basic tuples operations, Concatenation, Repetition, in Operator, Iteration, Built-in tuple functions, indexing, slicing and matrices. Creating a Dictionary, Accessing Values in a dictionary, Updating Dictionary, Deleting Elements from Dictionary, Properties of Dictionary keys, Operations in Dictionary, Built-In Dictionary Functions, Built-in Dictionary Methods. Sets- Definition, transaction of set(Adding, Union, intersection), working with sets
  • 5. SUBJECT SYLLABUS Continue… ▪ Chapter 4 Modules ,Working with files, Exception handling ▪ Modules: Importing module, Creating & exploring modules, Math module, Random module, Time module Packages: Importing package, creating package, examples ▪ Working with files: Creating files and Operations on files (open, close, read, write), File object attributes, file positions, Listing Files in a Directory, Testing File Types, Removing files and directories, copying and renaming files, splitting pathnames, creating and moving directories ▪ Regular Expression: Concept of regular expression, various types of regular expressions, using match function. ▪ Exception Handling: Built-in Exceptions, Handling Exceptions, Exception with Arguments, User-defined Exceptions.
  • 6. SUBJECT SYLLABUS Continue… ▪ Chapter 4 Modules ,Working with files, Exception handling ▪ Modules: Importing module, Creating & exploring modules, Math module, Random module, Time module Packages: Importing package, creating package, examples ▪ Working with files: Creating files and Operations on files (open, close, read, write), File object attributes, file positions, Listing Files in a Directory, Testing File Types, Removing files and directories, copying and renaming files, splitting pathnames, creating and moving directories ▪ Regular Expression: Concept of regular expression, various types of regular expressions, using match function. ▪ Exception Handling: Built-in Exceptions, Handling Exceptions, Exception with Arguments, User-defined Exceptions.
  • 7. SUBJECT SYLLABUS Continue… Programming Assignments ▪ Assignment 1 - Python Basics ▪ Assignment 2 – Arrays, Strings, and Functions Assignment 3 - List, Tuples, Sets, and Dictionary ▪ Assignment 4 - File Handling and Date-Time ▪ Assignment 5 - Exception handling and Regular expression Reference Books: ▪ 1. An Introduction to Computer Science using Python 3 by Jason Montojo, Jennifer Campbell, Paul Gries, The pragmatic bookshelf-2013 ▪ 2. James Payne, “Beginning Python: Using Python and Python 3.1,Wrox Publication ▪ 3. Introduction to Computer Science Using Python- Charles Dierbach, Wiley Publication Learning with Python “, Green Tea Press, 2002 ▪ 4. Introduction to Problem Solving with Python by E balguruswamy,TMH publication- 2016 ▪ 5. Beginning Programming with Python for Dummies Paperback – 2015 by John Paul Mueller ▪ 6. Object-oriented Programming in Python, Michael H. Goldwasser, David Letscher, Pearson Prentice Hall- 2008
  • 9. INTRODUCTION: What is Python Programming Language? ▪ Python is an object-oriented programming language created by Guido Rossum in 1989. It is ideally designed for rapid prototyping of complex applications. ▪ It has interfaces to many OS system calls and libraries and is extensible to C or C++. ▪ Many large companies use the Python programming language, including NASA, Google, YouTube, BitTorrent, etc. Applications of Python Programming: 1. Web Applications. 2. GUI based desktop Applications. 3. Scientific and Numeric Applications. 4. Software Development. 5. Business Applications. 6. Console based Applications. 7. Audio or Video based Applications. 8. 3D CAD Applications. 9. Enterprise Applications. 10. Applications for images. 11. Education.
  • 10. About Python Programming Language: ▪ Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently whereas the other languages use punctuations. It has fewer syntactical constructions than other languages. ▪ 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.
  • 11. Python's features: ▪ Python's features include- ▪ Easy-to-learn: Python has few keywords, simple structure, and a clearly defined syntax. This allows a 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. ▪ 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.
  • 12. Python's features: continue… ▪ 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 scripting. Apart from the above-mentioned features, Python has a big list of good features. ▪ A few are listed below- ▪ 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.
  • 13. PYTHON PROGRAMMING LANGUAGE Installing Python Python editors for doing python programming: ▪ IDLE ▪ PyCharm ▪ Spyder ▪ PyDev ▪ Jupiter Notebook.
  • 14. Python Basic Modes: ▪ Interactive Mode: Sybmol-- “>>>” ▪ It means ready to accept interactive commands. ▪ For Ex: >>> print(“interactive mode”) ▪ Script Mode: File->New File to open blank script to write the code. Then save the script with .py extension. To run the script, Select Run->”Run Module”
  • 15. BASICS OF PYTHON CONTENTS OVERVIEW ▪ Standard datatypes ▪ Variables ▪ Constants ▪ Identifiers ▪ Reserved Words ▪ Lines, Indentation and Multiline Statements ▪ Input Output Functions ▪ Operations on Data Using Operators
  • 16. Structure of Python Program- Documentation Section Import Statement Global Declaration Section Class Section Subprogram Section Play Ground Section Data Members Members Functions Optional Essential
  • 17. STANDARD DATA TYPES LIST OF DATA TYPES USED IN PYTHON PROGRAMMING LANGUAGE: 1.Numbers—Integers, floats, fractions, Complex Numbers 2.Strings—Text characters, special symbols or Alphanumeric data 3.List—Sequential data 4.Tuple—like list with little difference. 5.Dictionary—Unordered collection of key value pairs. 6.Boolean– The simplest build-in type in python is the bool data type, it represents the two values, True and False. 7.None-Python defines a special variable None denoting a “Null object". None in python is used for defining null variables and objects.
  • 18. 2 ] Variables ▪ Variable is like a container that stores values that we can access or change. It is a way of pointing to a memory location used by a program. ▪ Syntax : variable=value 3] Constants A constant is a type of variable whose value cannot be changed during the execution of program. constants are usually declared and assigned in a module. For eg: PI=3.14 4] Literals in python 5] Identifiers 6] Reserved words eg: and,as ,assert,break 7] Comments eg: #
  • 19. Input / Output Functions: ▪ Input function helps to enter data at run time by the user and the output function. ▪ Input() : Input function reads a line of input from the keyboard. In python input() is used to take input from user. ▪ Syntax:- variable_name=input() //withput argument ▪ Variable_name=input(‘string’) //with argument ▪ Operations on Data using Operators 1. Unary 5.Bitwise operators 2. Binary 6.Relational or comparison operators 3. Arithmetic Operators 7.Identity operators 4. Logical 8.Membership operators
  • 20. INPUT AND OUTPUT FUNCTION ▪ Input(): reads a line of input from the keyboard. In python, input() function is used to take the input from the user. ▪ Print(): print() function is used to output data to the standard output device. ▪ Syntax: input()-input(“string”) ▪ print()---print(“string”)
  • 21. PRECEDENCE AND ASSOCIATIVITY OF OPERATORS IN PYTHON 11-NOV-2021
  • 22. The operator precedence in Python is listed in the following table. It is in descending order (upper group has higher precedence than the lower ones). Operators Meaning () Parentheses ** Exponent +x, -x, ~x Unary plus, Unary minus, Bitwise NOT *, /, //, % Multiplication, Division, Floor division, Modulus +, - Addition, Subtraction <<, >> Bitwise shift operators & Bitwise AND ^ Bitwise XOR | Bitwise OR ==, !=, >, >=, <, <=, is, is not, in, not in Comparisons, Identity, Membership operators not Logical NOT and Logical AND or Logical OR
  • 23. Standard Data Types ▪ Dictionary Data Type: ▪ Represents a collection of data that associate a unique key with each value. ▪ SETS: A set is an unordered collection of items. Every element is unique(no duplicates) and must be immutable(which can not be changed.
  • 24. CH.2 CONTROL STATEMENTS ▪ 1.TYPE CONVERSION ▪ 2.CONDITIONAL STATEMENTS 1. If statement: If condition: statements(s) 2. If else statement: If condition: statement(s) else: statement(s)
  • 25. CH.2 CONTROL STATEMENTS ▪ 3. if elif else statement: If(condition 1): statements elif(condition 2): statements ….. elif(condition-n) Statements else: statements
  • 26. CH.2 CONTROL STATEMENTS continue… Nested if statement: ▪ Syntax: ▪ If condition1: If condition2: statement1 else: statement2 else: statement3 .
  • 27. LOOPING: ▪ While Loop: Syntax: while condition: statement(s)
  • 28. CH.2 CONTROL STATEMENTS continue… ▪ For Loop: ▪ For iterating_var in sequence : ▪ Statement(s)
  • 29. Loop Control Statements: ▪ 1.break ▪ 2. continue ▪ 3.pass