CST 445 Python For Engineers - Open Elective
CST 445 Python For Engineers - Open Elective
CST 445 Python For Engineers - Open Elective
YEAR OF
PYTHON FOR CATEGORY L T P CREDIT INTRODUCTION
CST445 ENGINEERS
OEC 2 1 0 3 2019
Preamble: The objective of the course is to provide learners an insight into Python programming
in a scientific computation context and develop programming skills to solve engineering
problems. It covers programming environment, important instructions, data representations,
intermediate level features, Object Oriented Programming and file data processing of Python.
This course lays the foundation to scientific computing, develop web applications, Machine
Learning, and Artificial Intelligence-based applications and tools, Data Science and Data
Visualization applications.
Prerequisite: NIL
Note : Students who have successfully completed CST 283 - Python for Machine Learning
(Minor) are not eligible to opt this course.
Course Outcomes: After the completion of the course the student will be able to
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1
CO2
CO3
CO4
CO5
CO6
Assessment Pattern
Test 1 (Marks in Test 2 (Marks End Semester
Bloom’s Category
percentage) in percentage) Examination Marks
Remember 20 20 20
Understand 30 30 30
Apply 50 50 50
Analyse
Evaluate
Create
Mark Distribution
Syllabus
Module 1 (Basics of Python)
Getting Started with Python Programming - Running code in the interactive shell, Editing,
Saving, and Running a script. Using editors - IDLE, Jupyter. Basic coding skills - Working with
data types, Numeric data types and Character sets, Keywords, Variables and Assignment
statement, Operators, Expressions, Working with numeric data, Type conversions, Comments in
the program, Input Processing, and Output, Formatting output. How Python works. Detecting
and correcting syntax errors. Using built in functions and modules in math module. Control
statements - Selection structure - if-else, if-elif-else. Iteration structure - for, while. Testing the
control statements. Lazy evaluation.
Text Books:
1. Kenneth A Lambert., Fundamentals of Python : First Programs, 2/e, Cengage Publishing, 2016
2. David J. Pine, Introduction to Python for Science and Engineering, CRC Press, 2021
Reference Books:
1. Wes McKinney, Python for Data Analysis, 2/e, Shroff / O’Reilly Publishers, 2017
2. Allen B. Downey, Think Python: How to Think Like a Computer Scientist, 2/e, Schroff, 2016
3. Michael Urban and Joel Murach, Python Programming, Shroff/Murach, 2016
4. David M.Baezly, Python Essential Reference. Addison-Wesley Professional; 4/e, 2009.
5. Charles Severance. Python for Informatics: Exploring Information,
6. http://swcarpentry.github.io/python-novice-gapminder/
Course Outcome1(CO1):
1. What is type conversion? How is it done in Python?
Reg No:_______________
Name:_________________
Plot the function y = 3x2 for −1 ≤ x ≤ 3 as a continuous line. Include enough points so that
8.
the curve you plot appears smooth. Label the axes x and y
9. Describe random number generation using Python
10. How can a generalized eigen value problem can be solved using Python?
PART-B
(Answer any one full question from each module)
Module -1
11. (a) Compare and contrast interpreted languages and compiled languages. (6)
How does it affect the quality of program development and execution of
the program?
(b) What are the possible errors in a Python program. Write a Python (8)
program to print the value of 22n+n+5 for n provided by the user.
OR
12. (a) Describe Arithmetic operators, Assignment operators, Comparison (6)
operators, Logical operators, and Bitwise operators in detail with examples.
(b) Input 4 integers (+ve and −ve). Write a Python code to find the sum of (8)
negative numbers, positive numbers, and print them. Also, find the averages
of these two groups of numbers and print
Module -2
13. (a) Write a Python code to create a function called list_of_frequency that takes a (5)
string and prints the letters in non-increasing order of the frequency of their
occurrences. Use dictionaries.
(b) Write a Python program to read a list of numbers and sort the list in a non- (9)
decreasing order without using any built in functions. Separate function
should be written to sort the list wherein the name of the list is passed as the
parameter.
OR
14. (a) Illustrate the following Set methods with an example. (8)
i. intersection( ) ii. Union( ) iii. Issubset( ) iv. Difference( ) v. update( ) vi.
discard( )
(b) Write a Python program to check the validity of a password given by the (6)
user.
The Password should satisfy the following criteria:
1. Contains at least one letter between a and z
2. Contains at least one number between 0 and 9
3. Contains at least one letter between A and Z
COMPUTER SCIENCE AND ENGINEERING
Module -5
19. (a) Write python program to solve the following system of equations (4)
x1 − 2x2 + 9x3 + 13x4 = 1
−5x1 + x2 + 6x3 − 7x4 = −3
4x1 + 8x2 − 4x3 − 2x4 = −2
8x1 + 5x2 − 7x3 + x4 = 5
(b) Given the sales information of a company as CSV file with the following (10)
fields month_number, facecream, facewash, toothpaste, bathingsoap,
shampoo, moisturizer, total_units, total_profit. Write Python codes to
visualize the data as follows
1) Toothpaste sales data of each month and show it using a scatter plot
2) Face cream and face wash product sales data and show it using the
bar chart
Calculate total sale data for last year for each product and show it using a
Pie chart.
OR
20. (a) Write Python program to write the data given below to a CSV file. (9)
SN Name Country Contribution Year
(b) Explain how integration is performed with SciPy. Illustrate the same with (5)
the two sample integrals using SciPy function.
COMPUTER SCIENCE AND ENGINEERING
Teaching Plan
Number of
Sl
Contents Hours (35
No
Hrs)
Module 1: Basics of Python (8 hours)
Getting Started with Python Programming: Running code in the interactive
1.1 1 hour
shell Editing, Saving, and Running a script
1.2 Using editors: IDLE, Jupyter 1 hour
Basic coding skills: Working with data types, Numeric data types and
1.3 Character sets, Keywords, Variables and Assignment statement, Operators, 1 hour
Expressions,
Working with numeric data, Type conversions, Comments in the program,
1.4 1 hour
Input Processing, and Output. Formatting output
How Python works. Detecting and correcting syntax errors. Using built in
1.5 1 hour
functions and modules in math module.
1.6 Control statements : Selection structure, if-else, if elifelse 1 hour
1.7 Iteration structure - for, while 1 hour
1.8 Testing the control statements, Lazy evaluation. 1 hour
Module 2: Functions and Python Data Structures (8 hours)
2.1 Functions: Hiding redundancy and complexity, Arguments and return values 1 hour
2.2 Variable scopes and parameter passing 1 hour
2.3 Named arguments, Main function, 1 hour
2.4 Working with recursion, Lambda functions 1 hour
2.5 Strings - String function 1 hour
Lists - Basic list Operations and functions, List of lists, Slicing, Searching
2.6 1 hour
and sorting list, List comprehension.
2.7 Work with tuples. Sets. 1 hour
Dictionaries - Dictionary functions, dictionary literals, adding and removing
2.8 1 hour
keys, Accessing and replacing values, traversing dictionaries, reverse lookup
Module 3: Object Oriented Programming (6 hours)
3.1 Design with classes : Objects and Classes, Methods, Instance Variables 1 hour
3.2 Constructor, Accessors, and Mutators 1 hour
3.3 Structuring classes with Inheritance 1 hour
3.4 Polymorphism 1 hour
3.5 Abstract Classes 1 hour
3.6 Exceptions: Handle a single exception, Handle multiple exception 1 hour
Module 4: Visualization and File handling (6 hours)
COMPUTER SCIENCE AND ENGINEERING