You are on page 1of 2

Python Theory Assignment

Theory Assignment-4: (Functions):

1. What are user-defined functions? With the help of an example

illustrate how you can have such functions in your program.

2. What is recursion? Write and explain a Python program to find

factorial of number using recursion.

3. What are modules, How to import a module? Explain time module.

4. Can a function call another function? Justify your answer with the help

of an example.

5. Define function and give its advantages.

Theory Assignment-5: (File handling):

1. Explain different modes of opening a file, and why do we need files?

2. Explain the use of format () with the help of an example.

3. With the help of suitable examples explain different ways in which you

can write data in a file.

4. With the help of an example explain any three attributes of file object.

5. Differentiate between the following

 a method and a function

 find() and index()

You might also like