Assign 5
Assign 5
ASSIGNMENT- 5
• This assignment is my original work and no part of it has been copied from any other student’s work or from
any other source except where due acknowledgment is made.
• No part of this assignment has been written for me by any other person except where such collaboration has
been authorized by the faculty concerned and must be clearly acknowledged.
• I give permission to copy the marked work to be retained in the department for NBA requirement.
• I understand plagiarism and obey the academic ethics.
• I understand that academic misconduct is a punishable offence.
COs
Addressed Total
Max
Marks
Marks
Obtained
Remarks:
Signature
Faculty: Binu VP
1. What are lambda functions?
Let f(x)=x^2+3x+5 g(x,y)=x^2y+5xy+6
Find f(2)+g(3,2) using lambda functions.
In Python, a lambda function is a small, anonymous function that can take any number of arguments, but
can only have one expression. Lambda functions are also known as anonymous functions, inline
functions or single-expression functions.
3. Use list comprehension to create a list of odd numbers less than 50.
Use lambda function and map function to find the cube of numbers stored in the list. Use
lambda function and filter function to find the numbers divisible by 3.
4. Write a function prime (n) which will return True if the number is prime or else False
Use the above function to print numbers less than 100.
5. Write a recursive function to find the factorial of a given number Use the above function
to compute nCr.
6. Write a recursive function to find the n’th Fibonacci number Use the above function to
print the Fibonacci series.
7. Use a recursive function to find the sum of the digits of a number.
8. Write a function which will take n numbers as argument and return the largest element
9. Find the binary equivalent of each digit of a number(ie;BCD each digit is represented
as 4 bit binary). Use a separate function to find binary.
10. Find the sum of the cosine series 1-x^2/2!+x^4/4!-x^6/6!..... n terms.Use a function fact to
find the factorial of the number.