0% found this document useful (0 votes)
23 views1 page

Python Functions and File Operations Guide

The document outlines various Python programming concepts and functions, including string methods like join(), endswith(), center(), and split(), as well as file handling techniques using open(), read(), and write(). It also covers directory and file operations such as makedir(), getcwd(), and file manipulation methods like copying, moving, and deleting files. Additionally, it discusses assertions, polymorphism, class and object definitions, and the use of __init__() and __str__() methods in class construction.

Uploaded by

m45179706
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Python Functions and File Operations Guide

The document outlines various Python programming concepts and functions, including string methods like join(), endswith(), center(), and split(), as well as file handling techniques using open(), read(), and write(). It also covers directory and file operations such as makedir(), getcwd(), and file manipulation methods like copying, moving, and deleting files. Additionally, it discusses assertions, polymorphism, class and object definitions, and the use of __init__() and __str__() methods in class construction.

Uploaded by

m45179706
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. Explain join (), ends with (), center () and split () method with examples.

2. Illustrate with example opening of a file with open( ) function, reading the contents of the file with read ( )

and writing to files with write( ).

3. Explain the following functions with example:

i)makedir() ii) getcwd() iii) isalpha() iv)upper() v)is_lower()

4. Read multidigit number from console. Develop a program to print frequency of occurrence of each

digit with suitable message.

5. Explain the following file operations in python with suitable example: i) Copying files and folders

ii)Moving files and folders iii) Permanently deleting files and folders.

6. What is meant by compressing files? Explain reading, extracting and creating ZIP files with an

example.

7. Define assertions. What does an assert statement in python consists of?

8. Explain safe delete and permanent delete with suitable Python programming.

9. Explain briefly pure functions and modifiers with examples.

10. Explain the concept of polymorphism with example.

11. Define a class and object. Construct the class called rectangle and initialize it with height =100,

width =200, starting point as (x=0, y=0). Write a program to display the centre point co-ordinates of

a rectangle.

12. Explain clearly __init__ () and __ str ()__ method with examples.

You might also like