/python-lab

The Python Programming Laboratory course (21CSL46) introduces students to Python fundamentals, data types, flow control, functions, and object-oriented programming. It covers regular expressions, file handling, and working with Excel, PDF, Word, and JSON files. CIE and SEE assessments ensure comprehensive learning and practical application.

Primary LanguagePythonCreative Commons Zero v1.0 UniversalCC0-1.0

Python 21CSL46

Python Programming Laboratory (21CSL46)

The Python Programming Laboratory course (21CSL46) introduces students to Python fundamentals, data types, flow control, functions, and object-oriented programming. It covers regular expressions, file handling, and working with Excel, PDF, Word, and JSON files. CIE and SEE assessments ensure comprehensive learning and practical application.

Course Overview

  1. Python Fundamentals and Flow Control:

    • Write Python programs to find the best of two test average marks and check for palindromes:
  2. Introduce the Python fundamentals, data types, operators, flow control and exception handling in Python (a) Write a python program to find the best of two test average marks out of three test’s marks accepted from the user. (b) Develop a Python program to check whether a given number is palindrome or not and also count the number of occurrences of each digit in the input number.

  3. Functions and Parameters:

    • Implement functions to calculate Fibonacci numbers and convert between number systems:
  4. Demonstrating creation of functions, passing parameters and return values (a) Defined as a function F as Fn = Fn-1 + Fn-2. Write a Python program which accepts a value for N (where N > 0) as input and pass this value to the function. Display suitable error message if the condition for input value is not followed.

(b) Develop a python program to convert binary to decimal, octal to hexadecimal using functions.

  1. String Manipulation:

    • Develop programs to analyze sentences and compare string similarity:
  2. Demonstration of manipulation of strings using string methods (a) Write a Python program that accepts a sentence and find the number of words, digits, uppercase letters and lowercase letters. (b) Write a Python program to find the string similarity between two given strings Sample Output: Sample Output: Original string: Original string: Python Exercises Python Exercises Python Exercises Python Exercise Similarity between two said strings: Similarity between two said strings: 1.0 0.967741935483871

  3. Collections:

    • Explore lists, tuples, and dictionaries to implement sorting algorithms and convert Roman numerals:
    1. Discuss different collections like list, tuple and dictionary (a) Write a python program to implement insertion sort and merge sort using lists (b) Write a program to convert roman numbers in to integer values using dictionaries.
  4. Pattern Recognition:

    • Create functions to recognize patterns and search for phone numbers and email addresses:
  5. Demonstration of pattern recognition with and without using regular expressions (a) Write a function called isphonenumber () to recognize a pattern 415-555-4242 without using regular expression and also write the code to recognize the same pattern (b) Develop a python program that could search the text in a file for phone numbers (+919900889977) and email addresses (sample@gmail.com)

  6. File Operations:

    • Perform operations on files, including reading, writing, and organizing data. Create ZIP files:
  7. Demonstration of reading, writing and organizing files. (a) Write a python program to accept a file name from the user and perform the following operations

  8. Display the first N line of the file

  9. Find the frequency of occurrence of the word accepted from the user in the file (b) Write a python program to create a ZIP file of a particular folder which contains several files inside it.

  10. Object-Oriented Programming:

    • Utilize inheritance to find areas of geometric shapes and manage employee details:
  11. Demonstration of the concepts of classes, methods, objects and inheritance (a) By using the concept of inheritance write a python program to find the area of triangle, circle and rectangle. (b) Write a python program by creating a class called Employee to store the details of Name, Employee_ID, Department and Salary, and implement a method to update salary of employees belonging to a given department.

  12. Polymorphism and Overriding:

    • Implement polymorphic functions to check palindromes:
    1. Demonstration of classes and methods with polymorphism and overriding (a) Write a python program to find the whether the given input is palindrome or not (for both string and integer) using the concept of polymorphism and inheritance.
  13. Data Handling:

    • Download XKCD comics and manipulate spreadsheet data:
  14. Demonstration of working with excel spreadsheets and web scraping (a) Write a python program to download the all XKCD comics (b) Demonstrate python program to read the data from the spreadsheet and write the data in to the spreadsheet

  15. File Formats:

    • Combine PDF pages and fetch weather data from JSON files:
  16. Demonstration of working with PDF, word and JSON files (a) Write a python program to combine select pages from many PDFs (b) Write a python program to fetch current weather data from the JSON file

Assessment

This course includes continuous internal evaluation (CIE) and semester-end examination (SEE) to ensure comprehensive learning and practical application.

Thank you for visiting the OpenLearnHub organization to learn Python Lab for the 4th semester under the 2021 scheme of VTU.

Happy learning!