Python Syllabus
Python Syllabus
Python Syllabus
COURSE OBJECTIVES:
To teach the fundamentals of Python
To elucidate problem-solving using a Python programming language
To introduce a function-oriented programming paradigm through python
To develop the skill of designing Graphical user Interfaces in Python
To learn how to use lists, tuples, and dictionaries in Python programs.
Unit I:
Introduction: What is a program, running python, Arithmetic operators, Value and Types?
Variables, Assignments and Statements: Assignment statements, Script mode, Order of operations, string
operations, comments.
Functions: Function calls, Math functions, Composition, Adding new Functions, Definitions and Uses, Flow
of Execution, Parameters and Arguments, Variables and Parameters are local, Stack diagrams, Fruitful
Functions and Void Functions, Why Functions.
Case study: The turtle module, Simple Repetition, Encapsulation, Generalization, Interface design,
Refactoring, docstring.
Unit II:
Conditionals and Recursion: Floor division and modulus, Boolean expressions, Logical operators,
Conditional execution, Alternative execution, Chained conditionals, Nested conditionals, Recursion, Infinite
Recursion, Keyboard input.
Fruitful Functions: Return values, Incremental development, Composition, Boolean functions, More
recursion, Leap of Faith, Checking types
Iteration: Reassignment, Updating variables, The while statement, Break, Square roots, Algorithms.
Strings: A string is a sequence, len, Traversal with a for loop, String slices, Strings are immutable,
Searching, Looping and Counting, String methods, The in operator, String comparison.
Learning Outcomes: Student should be able to
Apply the conditional execution of the program (L3)
Apply the principle of recursion to solve the problems (L3)
Unit III:
Case Study: Reading word lists, Search, Looping with indices.
Lists: List is a sequence, Lists are mutable, Traversing a list, List operations, List slices, List methods, Map
filter and reduce, Deleting elements, Lists and Strings, Objects and values, Aliasing, List arguments.
Dictionaries: A dictionary is a mapping, Dictionary as a collection of counters, Looping and dictionaries,
Reverse Lookup, Dictionaries and lists, Memos, Global Variables.
Tuples: Tuples are immutable, Tuple Assignment, Tuple as Return values, Variable-length argument
tuples, Lists and tuples, Dictionaries and tuples, Sequences of sequences.
Unit IV:
Files: Persistence, Reading and writing, Format operator, Filename and paths, Catching exceptions,
Databases, Pickling, Pipes, Writing modules.
Classes and Objects: Programmer-defined types, Attributes, Instances as Return values, Objects are
mutable, Copying.
Classes and Functions: Time, Pure functions, Modifiers, Prototyping versus Planning
Classes and Methods: Object oriented features, Printing objects, The init method, The __str__method,
Operator overloading, Type-based Dispatch, Polymorphism, Interface and Implementation
Inheritance: Card objects, Class attributes, Comparing cards, decks, Printing the Deck, Add Remove
shuffle and sort, Inheritance, Class diagrams, Data encapsulation.
Text books:
1) Allen B. Downey, “Think Python”, 2nd edition, SPD/O’Reilly, 2016.
2) GowriShankar S., Veena A, “Introduction to Python Programming”, CRC Press.
Reference Books:
1) Martin C.Brown, “The Complete Reference: Python”, McGraw-Hill, 2018.
2) Kenneth A. Lambert, B.L. Juneja, “Fundamentals of Python”, CENGAGE, 2015.
3) R. Nageswara Rao, “Core Python Programming”, 2nd edition, Dreamtech Press, 2019
COURSE OBJECTIVES:
To train the students in solving computational problems
To elucidate solving mathematical problems using Python programming language
To understand the fundamentals of Python programming concepts and its applications.
LIST OF TOPICS
1. Write a program to demonstrate:
(a) Different numeric data types, and
(b) To perform different Arithmetic Operations on numbers in Python.
2. Write a program to create, append, and remove lists in Python.
3. Write a program to demonstrate working with tuples in Python.
4. Write a program to demonstrate working with dictionaries in Python.
5. Write a program to demonstrate a) arrays b) array indexing such as slicing, integer array indexing
and Boolean array indexing along with their basic operations in NumPy.
6. Write a program that accepts a string from the user and display the same string after removing
vowels from it.
7. Write a program to strip a set of characters from a string.
8. Write a function that prompts the user for the average temperature for each day of the week and
returns a dictionary containing the required information.
9. Write a program that has the dictionary of your friends names as keys and phone numbers as its
values. Print the dictionary in a sorted order. Prompt the user to enter the name and check if it is
present in the dictionary. If the name is not present, then enter the details in the dictionary.
10. Write a program to store the latitude and longitude of your house as a tuple and display it.
11. Write a program to do the following operations on files:
(a) Count the occurrence of each letter
(b) read the last n lines
(c) remove new line characters from the file
(d) read random line from a file
(e) read and write the contents from one csv file to another.
12. Write a program to add two polynomials using classes.
13. Create a class called library with data attributes accno, publisher, title and author. The methods of
the class should include
(a) read() accno, title, author
(b) compute() – to accept the number of days late, calculate an display the fine charged at the rate
of Rs. 10 per day.
(c) display the data.
14. Create a program to compute summary statistics such as mean, median, mode, standard deviation
and variance of the given different types of data.
15. Write a program to create and display a Data Frame from a dictionary of data which has the index
labels.
16. Write a program to create and display a one-dimensional array-like object containing an array of
data using pandas library
17. Write a python program to add, subtract, multiply and divide two pandas series.
Optional
18. Develop a Python program to solve the n-queen problem with and without recursion.
Problem Description
The n-queen problem is the problem of placing n queens on an n x n chessboard such that no
queen can attack another queen.
19. Design a python program to design a Calculator and Countdown timer.
20. Design a program in which the computer randomly chooses a number between 1 to 10, 1 to 100, or
any range. Then give users a hint to guess the number. Every time the user guesses wrong, he
gets another clue, and his score gets reduced. The clue can be multiples, divisible, greater or
smaller, or a combination of all.
21. Design a simple youtube video downloader.
22. Develop a Python program which blocks the unnecessary website popups
Textbooks:
1. Francois Chollet, Deep Learning with Python, 1/e, Manning Publications Company, 2017
2. Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers, “How to Think Like a
Computer Scientist: Learning with Python 3”, 3rd edition, Available at
http://www.ict.ru.ac.za/Resources/cspw/thinkcspy3/thinkcspy3.pdf
3. Paul Barry, “Head First Python a Brain Friendly Guide” 2nd Edition, O’Reilly, 2016
4. Dainel Y.Chen “Pandas for Everyone Python Data Analysis” Pearson Education, 2019
COURSE OUTCOMES:
At the end of the course, the student will be able to
Illustrate the use of various data structures. (L3)
Analyze and manipulate Data using Pandas (L4)
Design solutions to real-world problems using Python (L6)