TH: 03 Hrs/Week 04 In-Semester : 30 Marks PR : 02 Hrs/Week End-Semester : 70 Marks PR : 25 Marks Prerequisite Courses, if any: students are expected to have a good understanding of basic computer principles. Companion Course, if any: Programming and Problem Solving Laboratory (110005) Course Objectives: Prime objective is to give students a basic introduction to programming and problem solving with computer language Python. And to introduce students not merely to the coding of computer programs, but to computational thinking, the methodology of computer programming, and the principles of good program design including modularity and encapsulation. 1. To understand problem solving, problem solving aspects, programming and to know about various program design tools. 2. To learn problem solving with computers 3. To learn basics, features and future of Python programming. 4. To acquaint with data types, input output statements, decision making, looping and functions in Python 5. To learn features of Object Oriented Programming using Python 6. To acquaint with the use and benefits of files handling in Python Following Fields are applicable for courses with companion Laboratory course Course Outcomes: On completion of the course, learner will be able to– CO1: Inculcate and apply various skills in problem solving. CO2: Choose most appropriate programming constructs and features to solve the problems in diversified domains. CO3: Exhibit the programming skills for the problems those require the writing of well- documented programs including use of the logical constructs of language, Python. CO4: Demonstrate significant experience with the Python program development environment. Course Contents Unit I Problem Solving, Programming and Python Programming (07 Hrs) General Problem Solving Concepts- Problem solving in everyday life, types of problems, problem solving with computers, difficulties with problem solving, problem solving aspects, top down design. Problem Solving Strategies, Program Design Tools: Algorithms, Flowcharts and Pseudo-codes, implementation of algorithms. Basics of Python Programming: Features of Python, History and Future of Python, Writing and executing Python program, Literal constants, variables and identifiers, Data Types, Input operation, Comments, Reserved words, Indentation, Operators and expressions, Expressions in Python. Unit II Decision Control Statements (08 Hrs) Decision Control Statements: Decision control statements, Selection/conditional branching Statements: if, if-else, nested if, if-elif-else statements. Basic loop Structures/Iterative statements: while loop, for loop, selecting appropriate loop. Nested loops, The break, continue, pass, else statement used with loops. Other data types- Tuples, Lists and Dictionary. Unit III Functions and Modules (08 Hrs) Need for functions, Function: definition, call, variable scope and lifetime, the return statement. Defining functions, Lambda or anonymous function, documentation string, good programming practices. Introduction to modules, Introduction to packages in Python, Introduction to standard library modules. Unit IV Strings (07 Hrs) Strings and Operations- concatenation, appending, multiplication and slicing. Strings are immutable, strings formatting operator, built in string methods and functions. Slice operation, ord() and chr() functions, in and not in operators, comparing strings, Iterating strings, the string module. Unit V Object Oriented Programming (08 Hrs) Programming Paradigms-monolithic, procedural, structured and object oriented, Features of Object oriented programming-classes, objects, methods and message passing, inheritance, polymorphism, containership, reusability, delegation, data abstraction and encapsulation. Classes and Objects: classes and objects, class method and self object, class variables and object variables, public and private members, class methods. Unit VI File Handling and Dictionaries (07 Hrs) Files: Introduction, File path, Types of files, Opening and Closing files, Reading and Writing files. Dictionary method. Dictionaries- creating, assessing, adding and updating values. Case Study: Study design, features, and use of any recent, popular and efficient system developed using Python. (This topic is to be excluded for theory examination). Text Books: 1. Reema Thareja, “Python Programming Using Problem Solving Approach”, Oxford University Press, ISBN 13: 978-0-19-948017-6 2. R. Nageswara Rao, “Core Python Programming”, Dreamtech Press; Second edition ISBN- 10: 938605230X, ISBN-13: 978-9386052308 ASIN: B07BFSR3LL Reference Books: 1. R. G. Dromey, “How to Solve it by Computer”, Pearson Education India; 1st edition, ISBN- 10: 8131705625, ISBN-13: 978-8131705629 Maureen Spankle, “Problem Solving and Programming Concepts”, Pearson; 9th edition, ISBN-10: 9780132492645, ISBN-13: 978- 0132492645 2. Romano Fabrizio, “Learning Python”, Packt Publishing Limited, ISBN: 9781783551712, 1783551712 3. Paul Barry, “Head First Python- A Brain Friendly Guide”, SPD O’Reilly, 2nd Edition, ISBN:978-93-5213-482-3 4. Martin C. Brown, “Python: The Complete Reference”, McGraw Hill Education, ISBN-10: 9789387572942, ISBN-13: 978-9387572942, ASIN: 9387572943 5. Jeeva Jose, P. Sojan Lal, “Introduction to Computing & Problem Solving with Python”, Khanna Computer Book Store; First edition, ISBN-10: 9789382609810, ISBN-13: 978- 9382609810 Programming and Problem Solving Laboratory Guidelines for Instructor's Manual The instructor’s manual is to be developed as a hands-on resource and reference. The instructor's manual need to include prologue (about University/program/ institute/ department/foreword/ preface etc), copy of curriculum, conduction & Assessment guidelines, topics under consideration- concept, objectives, outcomes, set of typical applications/assignments/ guidelines, and references. Guidelines for Student's Lab Journal The laboratory assignments are to be submitted by student in the form of journal. Journal consists of prologue, Certificate, table of contents, and handwritten write-up of each assignment (Title, Objectives, Problem Statement, Outcomes, software & Hardware requirements, Date of Completion, Assessment grade/marks and assessor's sign, Theory-Concept in brief, features of tool/framework/language used, Design, test cases, conclusion. Program codes with sample output of all performed assignments are to be submitted as softcopy. As a conscious effort and little contribution towards Green IT and environment awareness, attaching printed papers as part of write-ups and program listing to journal may be avoided. Use of DVD containing students programs maintained by lab In-charge is highly encouraged. For reference one or two journals may be maintained with program prints at Laboratory. Guidelines for Lab /TW Assessment Continuous assessment of laboratory work is done based on overall performance and lab assignments performance of student. Each lab assignment assessment will assign grade/marks based on parameters with appropriate weightage. Suggested parameters for overall assessment as well as each lab assignment assessment include- timely completion, performance, innovation, efficient codes, punctuality and neatness. Guidelines for Laboratory Conduction List of laboratory assignments is provided below for reference. The instructor is expected to frame the assignments by understanding the prerequisites, technological aspects, utility and recent trends related to the topic. The assignment framing policy need to address the average students and inclusive of an element to attract and promote the intelligent students. The instructor may set multiple sets of assignments and distribute among batches of students. It is appreciated if the assignments are based on real world problems/applications. Encourage students for appropriate use of coding style, proper indentation and comments. Use of open source software and recent version is to be encouraged. In addition to these, instructor may assign one real life application in the form of a mini-project based on the concepts learned. Instructor may also set one assignment or mini-project that is suitable to respective branch beyond the scope of syllabus. Suggested List of Laboratory Experiments/Assignments (Any 6 to 8 laboratory assignments) Sr. Problem Statement No. Write Program in Python (with function/class/file, as applicable) To calculate salary of an employee given his basic pay (take as input from user). Calculate gross salary of employee. Let HRA be 10 % of basic pay and TA be 5% of 1. basic pay. Let employee pay professional tax as 2% of total salary. Calculate net salary payable after deductions. To accept an object mass in kilograms and velocity in meters per second and display its 2. momentum. Momentum is calculated as e=mc2 where m is the mass of the object and c is its velocity. To accept N numbers from user. Compute and display maximum in list, minimum in list, 3. sum and average of numbers. To accept student’s five courses marks and compute his/her result. Student is passing if he/she scores marks equal to and above 40 in each course. If student scores aggregate 4. greater than 75%, then the grade is distinction. If aggregate is 60>= and <75 then the grade if first division. If aggregate is 50>= and <60, then the grade is second division. If aggregate is 40>= and <50, then the grade is third division. To check whether input number is Armstrong number or not. An Armstrong number is an 5. integer with three digits such that the sum of the cubes of its digits is equal to the number itself. Ex. 371. To simulate simple calculator that performs basic tasks such as addition, subtraction, 6. multiplication and division with special operations like computing xy and x!. To accept the number and Compute a) square root of number, b) Square of number, c) 7. Cube of number d) check for prime, d) factorial of number e) prime factors To accept two numbers from user and compute smallest divisor and Greatest Common 8. Divisor of these two numbers. 9. To accept a number from user and print digits of number in a reverse order. 10. To input binary number from user and convert it into decimal number. 11. To generate pseudo random numbers. 12. To accept list of N integers and partition list into two sub lists even and odd numbers. 13. To accept the number of terms a finds the sum of sine series. To accept from user the number of Fibonacci numbers to be generated and print 14. the Fibonacci series. Write a python program that accepts a string from user and perform following string 15. operations- i. Calculate length of string ii. String reversal iii. Equality check of two strings iii. Check palindrome ii. Check substring To copy contents of one file to other. While copying a) all full stops are to be replaced 16. with commas b) lower case are to be replaced with upper case c) upper case are to be replaced with lower case. To count total characters in file, total words in file, total lines in file and frequency of 17. given word in file. Create class EMPLOYEE for storing details (Name, Designation, gender, Date of Joining and Salary). Define function members to compute a)total number of employees in an 18. organization b) count of male and female employee c) Employee with salary more than 10,000 d) Employee with designation “Asst Manager” Create class STORE to keep track of Products ( Product Code, Name and price). Display 19. menu of all products to user. Generate bill as per order. Mini-Projects Calculator with basic functions. Add more functionality such as graphic user interface and 20. complex calculations. Program that simulates rolling dice. When the program runs, it will randomly choose a number between 1 and 6 (Or other integer you prefer). Print that number. Request user to 21. roll again. Set the min and max number that dice can show. For the average die, that means a minimum of 1 and a maximum of 6. Use raspberry pi/or similar kit and python for- Room Temperature Monitoring System Motion Detection System Soil Moisture Sensor 22. Home Automation System A robot Smart mirror or a smart clock. Smile Detection using Raspberry Pi Camera Guess Number: Randomly generate a number unknown to the user. The user needs to guess what that number is. If the user’s guess is wrong, the program should return some sort of indication as to how wrong (e.g. the number is too high or too low). If the user 23. guesses correctly, a positive indication should appear. Write functions to check if the user input is an actual number, to see the difference between the inputted number and the randomly generated numbers, and to then compare the numbers.