Python (PCC-CS393) : IT2 Year, 3 Semester, Year:2020 Assignment-2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Python (PCC-CS393)

IT 2nd Year, 3rd Semester, Year:2020


Assignment-2

1. Write a function that will take the first and last name of a person and returns the full name.

2. Write a function to check whether a given number is even or odd. Display the statement after
returning form the function.

3. Write a function to calculate simple interest. Take input the principle amount, number of years
and whether the customer is senior citizen or not. For senior citizen, the rate of interest is 12 and for
others it is 10. Use keyword arguments.

4. Write a function to calculate the volume of a cuboid using default arguments.

5. Write a function to sum the series 1/1! + 4/2! + 27/3! + ....

6. Write a function to add the values passed to a function using variable-length arguments.

7. Write a recursive function to print Fibonacci series.

8. Write a function to calculate exponent of a number using recursive function.


exp(x,y) = 1 if y = 0
y-1
= x * exp(x ) otherwise

9. Create your own module to calculate sum of two integers. Call this module from main module to
find the sum of two numbers.

10. List all the identifiers defined in a module.

11. Print the multi-line comments mentioned inside a function.

12. Write a function to print absolute value, square roor value, exponential value and cube of a
number.

13. Write a function that accepts three integers and returns True if they are sorted, otherwise it
returns False.

14. Write a function that accepts two positive numbers n and m, where m<=n, and returns numbers
between 1 and n that are divisible by m.

You might also like