You are on page 1of 4

Course Code: CSP0307

Course Name: Basic Python Programming Semester: III

Credit Contact Hours (per Independent Study Hours (per Section


L T P
s week) week) (Group)
05 3 1 2 06 10 B. Tech. (CSE)
Objective(s): The Python programming language which is one of the most popular programming
languages worldwide. The course shows you how to use the free open-source Python to write basic
programs and high level applications using concepts such as Class, functions, variables, If Else
statements, For loops, While loops, iterative and recursive programs. This course will be of great
interest to all learners who would like to gain a thorough knowledge and understanding of the basic
components of computer programming using the Python language – and might be a gentle introduction
to programming for those who think they might have a longer term interest in the subject area.

Course Module Details


Knowledge of programming principles and concepts of object oriented
SELO
Prerequisites programming using C++.

Course Unit – 1 (Introduction to Python programming ) 1,6,8,


Contents Introduction, origin of Python, Downloading, Installing and Running Python, 12,18,
Python Basics: Comment, Identifier, Indentations, Basic data types, conversions, 21
operators, Build in functions. I/O Statements, Condition Statements & Loops: If,
else, elif, conditional expressions, while, for, break continue.

Unit – 2(Data Structures in Python)


Lists: Introduction ,Accessing list, Operations, Working with lists, Tuple:
Introduction, Accessing tuples, Operations, Working with list, Dictionaries: 12, 15
Introduction, Accessing values in dictionaries, Working with dictionaries, Set:
Introduction ,Accessing set, Operations, Working with sets

Unit-3(Functions, Modules, File Handling)


Functions: Defining a function, Calling a function, Types of functions, Function
Arguments, Anonymous function, Global and local variables, Recursion. 12, 15
Modules: Creating modules, Importing module, Packages, File Handling :Opening
and closing files, Reading and writing files.

Unit-4(Exceptional Handling, Regular Expressions)


Exception Handling: Exception, Exception Handling, Try and Except clause,, User
Defined Exceptions, Exception handling in files. 12, 15
Regular Expressions: Introduction/motivation, special symbols and characters for
REs, Match function, Search function, Matching VS Searching, Modifiers, Patterns.

Unit – 5(Object Oriented Programming in Python)


Introduction, OOPS Basics: Class and object, Constructors, Need of
Encapsulations, Attributes, default attributes, static attributes, static methods,
Initializing objects, Pass by reference, self. Relational-ships: Introduction, 12, 15
Aggregation, Dependency. Inheritance: Need of Inheritance, Overriding, Super,
Types of Inheritance. Abstract Class, methods.

Courseware and Reference Books


Text Books
 Wesley J. Chun; Core Python Programming; Prentice Hall.
 Megnus Lie Hetland; Beginning Python from Novice to Professional, Apress.

References
 Mark Lutz; Programming Python; O’reilly.
 Dusty Philips; Python 3 Object Oriented Programming, PACKT Publishing.
 Steve Holden and David Beazley; Python Web Programming; New Riders.
Resources A computer system with following configuration:
Pentium P4/2.8 GHz (or higher) Processer Speed;
Windows XP (or higher) / Linux Operating System;
1 GB (or higher) RAM; 160 GB (or higher) HDD;
Jupiter Notebook, Python 3.6
Learning Outcomes After successful completion of this course, students
would be able to:

 Understand Python expressions and


statements
 Get user-input data and manipulate it.
 Understand simple and compound data types
such as integers, floats, strings, lists,
dictionaries, and tuples.
 Implement structures such as if statements
and loops
 Read from and write to external data files
using Python.
 Implement functions and call built-in Python
functions.
 Import and use library function modules
from the Python library.
 Handle programming errors and exceptions.
 Learn OOPs concepts & Implementation.

Contact Details (Head)


Department of Computer Science & Engineering /
Computer Applications
School of Engineering and Technology
ITM University, Gwalior
Email: hodcsit@itmuniversity.ac.in
S.NO. Practical List

1 Program to count the number of each vowel in a string. 1.0 Hours

2 Program to Find Sum of Natural Numbers Using Recursion. 1.0 Hours

3 Program To Display Powers of 2 Using Anonymous Function. 1.0 Hours

4 Program to Accept Three Digits and Print all Possible Combinations from the Digits. 1.0 Hours

5 Program to Find the Sum of the Series: 1 + x^2/2 + x^3/3 + … x^n/n. 1.0 Hours

6 Program to Create a List of Tuples with the First Element as the Number and Second Element as the
Square of the Number. 1.0 Hours

7 Program to Count the Frequency of Words Appearing in a String Using a Dictionary. 1.0 Hours

8 Program to Remove the Duplicate Items from a List. 1.0


Hours

9 Program that Displays which Letters are in the First String but not in the Second 1.0 Hours

10 ARS Gems Store sells different varieties of gems to its customers. Write a Python program to calculate
the bill amount to be paid by a customer based on the list of gems and quantity purchased. Any
purchase with a total bill amount above Rs.30000 is entitled for 5% discount. If any gem required by
the customer is not available in the store, then consider total bill amount to be -1. Assume that quantity
required by the customer for any gem will always be greater than 0. Perform case-sensitive comparison
wherever applicable. 1.0 Hours
11 Given a list of integer values. Write a python program to check whether it contains same number in
adjacent position. Display the count of such adjacent occurrences.
1.0 Hours

Sample Input Expected Output


[1,1,5,100,-20,-20,6,0,0] 3
[10,20,30,40,30,20] 0
[1,2,2,3,4,4,4,10] 3
12 Program to Count the Occurrences of a Word in a Text File. 1.0 Hours

13 Program to Read a File and Capitalize the First Letter of Every Word in the File. 1.0 Hours

14 Program to Create a Class which Performs Basic Calculator Operations 1.0 Hours

15 Program to Find the Area of a Rectangle Using Classes 1.0 Hours

PBL.

1. A traveler on a visit to India is in need of some Indian Rupees (INR) but he has money
belonging to another currency. He wants to know how much money he should provide in the
currency he has, to get the specified amount in INR. Write a python program to implement a
currency calculator which accepts the amount needed in INR and the name of the currency
which the traveler has. The program should identify and display the amount the traveler should
provide in the currency he has, to get the specified amount in INR.
Note: Use the forex information provided in the table below for the calculation. Consider that
only the currency names mentioned in the table are valid. For any invalid currency name,
display -1.

Currency Equivalent of 1.00 INR


Euro 0.01417
British Pound 0.0100
Australian Dollar 0.02140
Canadian Dollar 0.02027
2. Food Corner home delivers vegetarian and non-vegetarian combos to its customer based on
order. A vegetarian combo costs Rs.120 per plate and a non-vegetarian combo costs Rs.150 per
plate. Their non-veg combo is really famous that they get more orders for their non-vegetarian
combo than the vegetarian combo. Apart from the cost per plate of food, customers are also
charged for home delivery based on the distance in kms from the restaurant to the delivery
point. The delivery charges are as mentioned below:

Distance in kms Delivery charge in Rs per km


For first 3kms 0
For next 3kms 3
For the remaining 6

Given the type of food, quantity (no. of plates) and the distance in kms from the restaurant to
the delivery point, write a python program to calculate the final bill amount to be paid by a
customer. The below information must be used to check the validity of the data provided by the
customer:
 Type of food must be ‘V’ for vegetarian and ‘N’ for non-vegetarian.
 Distance in kms must be greater than 0.
 Quantity ordered should be minimum 1.
If any of the input is invalid, the bill amount should be considered as-1.
3. The Metro Bank provides various types of loans such as car loans, business loans and house
loans to its account holders. Write a python program to implement the following requirements:
 Initialize the following variables with appropriate input values:account_number,
account_balance, salary, loan_type, loan_amount_expected and
customer_emi_expected.
 The account number should be of 4 digits and its first digit should be 1.
 The customer should have a minimum balance of Rupees 1 Lakh in the account.
 If the above rules are valid, determine the eligible loan amount and the EMI that the
bank can provide to its customers based on their salary and the loan type they expect to
avail.
 The bank would provide the loan, only if the loan amount and the number of EMI’s
requested by the customer is less than or equal to the loan amount and the number of
EMI’s decided by the bank respectively.
Display appropriate error messages for all invalid data. If all the business rules are satisfied
,then display account number, eligible and requested loan amount and EMI’s.
Test your code by providing different values for the input variables.
No. of EMI’s required to
Salary Loan type Eligible loan amount
repay
> 25000 Car 500000 36
> 50000 House 6000000 60
> 75000 Business 7500000 84

You might also like