RGM COLLEGE OF ENGINEERING & TECHNOLOGY
(Autonomous)
Approved by AICTE, New Delhi.
Accredited by NAAC with A+ Grade.
Affiliated to J.N.T.University, Ananthapuram.
Nandyal – 518501. Kurnool (dist.), A.P.
YEAR/SEMESTER: II/I REGULATIONS: R-19
PYTHON PROGRAMMING (A0503193)
COURSE MATERIAL
PREPARED BY:
Mr. P. PRATHAP NAIDU
ASSISTANT PROFESSOR
DEPARTMENT OF CSE
RGMCET (Autonomous)
NANDYAL - 518501
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
, CSE-R-2019 SYLLABUS
R G M COLLEGE OF ENGINEERING & TECHNOLOGY, NANDYAL
AUTONOMOUS
COMPUTER SCIENCE ENGINEERING
II B.Tech. I-Sem (CSE) T C
2+1 3
PYTHON PROGRAMMING (A0503193)
(Common to all Branches)
COURSE OBJECTIVES: This course will enable students to:
Learn Syntax and Semantics of various Operators used in Python.
Understand about Various Input, Output and Control flow statements of Python.
Handle Strings and Files in Python.
Understand Lists, Tuples in Python.
Understand Sets, Dictionaries in Python.
Understand Functions, Modules and Regular Expressions in Python.
COURSE OUTCOMES: The students should be able to:
Examine Python syntax and semantics and be fluent in the use of various Operators
of Python.
Make use of flow control statements and Input / Output functions of Python.
Demonstrate proficiency in handling Strings and File Systems.
Create, run and manipulate Python Programs using core data structures like Lists
and Tuples.
Apply the core data structures like Sets and Dictionaries in Python Programming.
Demonstrate the use of functions, modules and Regular Expressions in Python.
MAPPING OF COs & POs
CO/ PO PO PO PO PO PO PO PO PO PO PO PO PSO PSO PSO
PO 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3
CO1 3 1 1 1 1
CO2 2 3 1 1 1 1
CO3 1 2 1 1 1 1
CO4 2 2 1 1 1 1
CO5 2 2 1 1 1 1
CO6 2 2 1 1 1 1
UNIT – I:
Introduction: History of Python, Need of Python Programming, Applications Basics of
Python Programming Using the REPL(Shell), Running Python Scripts, Variables,
Assignment, Keywords, Input-Output, Indentation. Overview on data types: Numbers,
Strings, Lists, Set, Tuple and Dictionaries.
Operators in Python: Arithmetic Operators, Comparison (Relational) Operators,
Assignment Operators, Logical Operators, Bitwise Operators, Shift Operators, Ternary
operator, Membership Operators, Identity Operators, Expressions and order of evaluations.
Illustrative examples on all the above operators.
UNIT – II:
Input and Output statements: input() function, reading multiple values from the keyboard
in a single line, print() function, ‘sep’ and ‘end’ attributes, Printing formatted string,
replacement operator ({}). Illustrative examples on all the above topics.
Control flow statements: Conditional statements – if, if-else and if-elif-else statements.
Iterative statements – for, while. Transfer statements – break, continue and pass.
Illustrative examples on all the above topics.
UNIT – III:
Strings: Introduction to strings, Defining and Accessing strings, Operations on string -
String slicing, Mathematical Operators for String, Membership operators on string,
Removing spaces from the string, Finding Substrings, Counting substring in the given
String, Replacing a string with another string, Splitting of Strings, Joining of Strings,
Changing case of a String, Checking starting and ending part of the string, checking type of
characters present in a string. Illustrative examples on all the above topics.
Files: Opening files, Text files and lines, Reading files, Searching through a file, Using try,
except and open, Writing files, debugging.
, CSE-R-2019
R G M COLLEGE OF ENGINEERING & TECHNOLOGY, NANDYAL
AUTONOMOUS
COMPUTER SCIENCE ENGINEERING
UNIT – IV:
Lists: Creation of list objects, Accessing and traversing the elements of list. Important
functions of list – len(), count(), index(), append(), insert(), extend(), remove(), pop(),
reverse() and sort(). Basic Operations on list: Aliasing and Cloning of List objects,
Mathematical Operators for list objects, Comparing list objects, Membership operators on
list, Nested Lists, List Comprehensions. Illustrative examples on all the above topics.
Tuples: Creation of Tuple objects, Accessing elements of tuple, Mathematical operators for
tuple, Important functions of Tuple – len(),count(),index(), sorted(), min(), max(), cmp().Tuple
Packing and Unpacking. Illustrative examples on all the above topics.
UNIT – V:
Sets: Creation of set objects, Accessing the elements of set. Important functions of set –
add(), update(), copy(), pop(),remove(),discard(),clear(). Basic Operations on set -
Mathematical Operators for set objects, Membership operators on list, Set Comprehensions.
Illustrative examples on all the above topics.
Dictionaries: Creation of Dictionary objects, Accessing elements of dictionary, Basic
operations on Dictionary - Updating the Dictionary, Deleting the elements from Dictionary.
Important functions of Dictionary – dict(), len(), clear(), get(), pop(), popitem(), keys(),
values(), items(), copy(), setdefault(). Illustrative examples on all the above topics.
UNIT – VI:
Functions - Defining Functions, Calling Functions, Types of Arguments - Keyword
Arguments, Default Arguments, Variable-length arguments, Anonymous Functions, Fruitful
functions (Function Returning Values), Scope of the Variables in a Function - Global and
Local Variables. Recursive functions, Illustrative examples on all the above topics.
Modules: Creating modules, import statement, from Import statement.
Regular Expressions: Character matching in regular expressions, Extracting data using
regular expressions, Combining searching and extracting, Escape character.
TEXT BOOKS
1) Python for Everybody: Exploring Data Using Python 3, 2017 Dr. Charles R.
Severance
REFERENCE BOOKS
1) Think Python, 2 Edition, 2017 Allen Downey, Green Tea Press
2) Core Python Programming, 2016 W.Chun, Pearson.
3) Introduction to Python, 2015 Kenneth A. Lambert, Cengages
4) https://www.w3schools.com/python/python_reference.asp
1) https://www.python.org/doc/
, UNIT - 1
Python Language Fundamentals
Topics Covered:
Introduction
Application areas of Python
Features of Python
Limitations of Python
Flavours of Python
Python Versions
Identifiers
Reserved Words
Datatypes
Typecasting
NOTE: If you really strong in the basics, then remaining things will become so easy
L1: What is Pyhton?
It is a Programming Language.
- We can develop applications by using this programming language.
We can say that, Python is a High-Level Programming Language. Immediately you may get doubt that,
What is the meaning of High-Level Programming Language.
- High-Level means Programmer friendly Programming Language. This means we are not
required to worry about Low-level things [i.e., Memory management, security, d
estroying the objects and so on.]
- By simply seeing the code programmer can understand the program. He can write th
e code vey easily.
- High level languages are Programmer friendly languages but not machine friendly
languages.
Let's take the following example,
localhost:8888/notebooks/Desktop/PythonCourse/Python Language Fundamentals.ipynb 1/81
(Autonomous)
Approved by AICTE, New Delhi.
Accredited by NAAC with A+ Grade.
Affiliated to J.N.T.University, Ananthapuram.
Nandyal – 518501. Kurnool (dist.), A.P.
YEAR/SEMESTER: II/I REGULATIONS: R-19
PYTHON PROGRAMMING (A0503193)
COURSE MATERIAL
PREPARED BY:
Mr. P. PRATHAP NAIDU
ASSISTANT PROFESSOR
DEPARTMENT OF CSE
RGMCET (Autonomous)
NANDYAL - 518501
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
, CSE-R-2019 SYLLABUS
R G M COLLEGE OF ENGINEERING & TECHNOLOGY, NANDYAL
AUTONOMOUS
COMPUTER SCIENCE ENGINEERING
II B.Tech. I-Sem (CSE) T C
2+1 3
PYTHON PROGRAMMING (A0503193)
(Common to all Branches)
COURSE OBJECTIVES: This course will enable students to:
Learn Syntax and Semantics of various Operators used in Python.
Understand about Various Input, Output and Control flow statements of Python.
Handle Strings and Files in Python.
Understand Lists, Tuples in Python.
Understand Sets, Dictionaries in Python.
Understand Functions, Modules and Regular Expressions in Python.
COURSE OUTCOMES: The students should be able to:
Examine Python syntax and semantics and be fluent in the use of various Operators
of Python.
Make use of flow control statements and Input / Output functions of Python.
Demonstrate proficiency in handling Strings and File Systems.
Create, run and manipulate Python Programs using core data structures like Lists
and Tuples.
Apply the core data structures like Sets and Dictionaries in Python Programming.
Demonstrate the use of functions, modules and Regular Expressions in Python.
MAPPING OF COs & POs
CO/ PO PO PO PO PO PO PO PO PO PO PO PO PSO PSO PSO
PO 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3
CO1 3 1 1 1 1
CO2 2 3 1 1 1 1
CO3 1 2 1 1 1 1
CO4 2 2 1 1 1 1
CO5 2 2 1 1 1 1
CO6 2 2 1 1 1 1
UNIT – I:
Introduction: History of Python, Need of Python Programming, Applications Basics of
Python Programming Using the REPL(Shell), Running Python Scripts, Variables,
Assignment, Keywords, Input-Output, Indentation. Overview on data types: Numbers,
Strings, Lists, Set, Tuple and Dictionaries.
Operators in Python: Arithmetic Operators, Comparison (Relational) Operators,
Assignment Operators, Logical Operators, Bitwise Operators, Shift Operators, Ternary
operator, Membership Operators, Identity Operators, Expressions and order of evaluations.
Illustrative examples on all the above operators.
UNIT – II:
Input and Output statements: input() function, reading multiple values from the keyboard
in a single line, print() function, ‘sep’ and ‘end’ attributes, Printing formatted string,
replacement operator ({}). Illustrative examples on all the above topics.
Control flow statements: Conditional statements – if, if-else and if-elif-else statements.
Iterative statements – for, while. Transfer statements – break, continue and pass.
Illustrative examples on all the above topics.
UNIT – III:
Strings: Introduction to strings, Defining and Accessing strings, Operations on string -
String slicing, Mathematical Operators for String, Membership operators on string,
Removing spaces from the string, Finding Substrings, Counting substring in the given
String, Replacing a string with another string, Splitting of Strings, Joining of Strings,
Changing case of a String, Checking starting and ending part of the string, checking type of
characters present in a string. Illustrative examples on all the above topics.
Files: Opening files, Text files and lines, Reading files, Searching through a file, Using try,
except and open, Writing files, debugging.
, CSE-R-2019
R G M COLLEGE OF ENGINEERING & TECHNOLOGY, NANDYAL
AUTONOMOUS
COMPUTER SCIENCE ENGINEERING
UNIT – IV:
Lists: Creation of list objects, Accessing and traversing the elements of list. Important
functions of list – len(), count(), index(), append(), insert(), extend(), remove(), pop(),
reverse() and sort(). Basic Operations on list: Aliasing and Cloning of List objects,
Mathematical Operators for list objects, Comparing list objects, Membership operators on
list, Nested Lists, List Comprehensions. Illustrative examples on all the above topics.
Tuples: Creation of Tuple objects, Accessing elements of tuple, Mathematical operators for
tuple, Important functions of Tuple – len(),count(),index(), sorted(), min(), max(), cmp().Tuple
Packing and Unpacking. Illustrative examples on all the above topics.
UNIT – V:
Sets: Creation of set objects, Accessing the elements of set. Important functions of set –
add(), update(), copy(), pop(),remove(),discard(),clear(). Basic Operations on set -
Mathematical Operators for set objects, Membership operators on list, Set Comprehensions.
Illustrative examples on all the above topics.
Dictionaries: Creation of Dictionary objects, Accessing elements of dictionary, Basic
operations on Dictionary - Updating the Dictionary, Deleting the elements from Dictionary.
Important functions of Dictionary – dict(), len(), clear(), get(), pop(), popitem(), keys(),
values(), items(), copy(), setdefault(). Illustrative examples on all the above topics.
UNIT – VI:
Functions - Defining Functions, Calling Functions, Types of Arguments - Keyword
Arguments, Default Arguments, Variable-length arguments, Anonymous Functions, Fruitful
functions (Function Returning Values), Scope of the Variables in a Function - Global and
Local Variables. Recursive functions, Illustrative examples on all the above topics.
Modules: Creating modules, import statement, from Import statement.
Regular Expressions: Character matching in regular expressions, Extracting data using
regular expressions, Combining searching and extracting, Escape character.
TEXT BOOKS
1) Python for Everybody: Exploring Data Using Python 3, 2017 Dr. Charles R.
Severance
REFERENCE BOOKS
1) Think Python, 2 Edition, 2017 Allen Downey, Green Tea Press
2) Core Python Programming, 2016 W.Chun, Pearson.
3) Introduction to Python, 2015 Kenneth A. Lambert, Cengages
4) https://www.w3schools.com/python/python_reference.asp
1) https://www.python.org/doc/
, UNIT - 1
Python Language Fundamentals
Topics Covered:
Introduction
Application areas of Python
Features of Python
Limitations of Python
Flavours of Python
Python Versions
Identifiers
Reserved Words
Datatypes
Typecasting
NOTE: If you really strong in the basics, then remaining things will become so easy
L1: What is Pyhton?
It is a Programming Language.
- We can develop applications by using this programming language.
We can say that, Python is a High-Level Programming Language. Immediately you may get doubt that,
What is the meaning of High-Level Programming Language.
- High-Level means Programmer friendly Programming Language. This means we are not
required to worry about Low-level things [i.e., Memory management, security, d
estroying the objects and so on.]
- By simply seeing the code programmer can understand the program. He can write th
e code vey easily.
- High level languages are Programmer friendly languages but not machine friendly
languages.
Let's take the following example,
localhost:8888/notebooks/Desktop/PythonCourse/Python Language Fundamentals.ipynb 1/81