Assignment No:08
Problem Statement: Write a python program to accept a file name from the user and perform the
following operations
1.Display the first N line of the file.
2.Find the frequency of occurrence of the word accepted from the user in the file.
Learning Objectives:
- To understand the basics about python file handling.
- To learn how to create a file in various mode and how to perform various operation on it.
Learning Outcomes:
- Upon completing this lab exercise, the learner will be able to
- Able to create file, write content in it and close the file.
- Able to open file in read mode, move the file pointer in any location inside the file.
- Understand the difference between data streaming and data buffering.
- Implementation of file program for user specific requirements.
Theory:
- What is data streaming?
- What is data buffering?
- What is serial data?
- What is Input Output Stream and what is buffer?
- Explain in detail different file access modes.
- Write a simple file handling program for explanation of seek () function.
- Write a simple file handling program for explanation of tell () function.
- What types of exceptions occurs in file handling program and how to handle those.
- How to write inside file and how to read one character at a time from file.
- Differentiate between readline () and readlines () function in file handling.
Note:
To get above question answers click the following link. Click the below link:
Write a python program to accept a file name from the user and perform operations. - DATA STRUCTURES AND ALGORITHMSAlgorithm:
Step 1: Start
Step 2: Accept the file name from the user.
Step 3: We are assuming that file is already created on HDD, so we simply open it into read mode.
Step 4: We are asking user how many n lines you want to display from file.
Step 5: Displaying the first n lines from the file.
Step 6: We are asking user to enter which word occurance he/she wants to find from the file.
Step 7: Counting the occurance of that word from the file.
Step 8: Showing the occurance of that word to the user.
Step 9: Stop
Conclusion: Hence, we learn how to create the file on secondary storage using python programming. also, we learn various operations on file to process the data as per user requirement.
----------------------------------------------------------------------------------------------------------------------
Assignment No:09
Problem Statement:
Write Python program covers basic functionalities provided by the math module.
Learning Objectives:
- To understand the basics about python modules in python.
- To learn various built-in modules inside python.
- To learn regular expression and its methods in python.
Learning Outcomes:
- Upon completing this lab exercise, the learner will be able to
- Able to create modules inside python.
- Able to create our own library by wrapping various function related with each other.
- Understand the various built-in modules inside python like math module
- Implementation of basic functionalities provided by the math module.
Theory:
- What is Module in python and how to create it?
- What is loading and reloading of module?
- Explain dir() function in python?
- How the module search path work in the python?
- List any nine methods of math modules.
Note:
To get above question answers click the following link. Click the below link:
Modules and Regular Expressions in Python. - DATA STRUCTURES AND ALGORITHMSAlgorithm:
Step 1: Start
Step 2: Display two constants of math module
Step 3: Call to basic functions in math modules.
Step 4: Call three Trigonometric functions from math modules.
Step 5: Call two Logarithmic functions from math module.
Step 6: Call two Exponential functions from math module.
Step 7: Call two Rounding functions from math module.
Step 8: Call factorial and GCD functions from math module.
Step 9: Call Degree and Radians functions from math module.
Step 10: Stop
Conclusion: Hence, we learn all the functionalities inside math module.
No comments:
Post a Comment