0% found this document useful (0 votes)
2 views

Function Practice Questions

The document contains a series of function practice questions related to Python programming. It covers definitions, examples, and tasks such as creating functions for arithmetic operations, string manipulations, and higher-order functions. Additionally, it addresses concepts like decorators, closures, and the differences between various types of arguments.

Uploaded by

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

Function Practice Questions

The document contains a series of function practice questions related to Python programming. It covers definitions, examples, and tasks such as creating functions for arithmetic operations, string manipulations, and higher-order functions. Additionally, it addresses concepts like decorators, closures, and the differences between various types of arguments.

Uploaded by

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

Function Practice Questions

1. What is a function in Python? Explain with an example.

2. Write a function that takes two numbers as arguments and returns their sum.

3. How do you call a function in Python?

4. Write a function that prints 'Hello, World!' when called.

5. What is the difference between a function and a method?

6. Write a function that checks if a given number is even or odd.

7. Write a function that takes a list as an argument and returns the largest number.

8. How do you return multiple values from a function?

9. Write a function that calculates the factorial of a given number.

10. What is the difference between positional arguments and keyword arguments?

11. Write a function to check if a string is a palindrome.

12. Write a recursive function to calculate the Fibonacci sequence.

13. What is the purpose of the *args and **kwargs parameters in a function?

14. Write a function that removes duplicates from a list without using built-in functions.

15. Explain the concept of higher-order functions with an example.

16. Write a lambda function to find the square of a number.

17. Write a function that accepts another function as an argument.

18. What is the difference between local and global variables?

19. Write a decorator function that prints 'Execution started' before executing another
function.

20. Explain the concept of closures with an example.

You might also like