Functions (def, return, scope, positional arguments, default arguments, keyword arguments)

  1. Write a Python program to find the sum of two numbers using a user-defined function ?
  2. Write a Python program to calculate the factorial of a number using a function ?
  3. Write a Python program to determine whether a number is prime using a function ?
  4. Write a Python program to calculate the area of a circle using a function with arguments ?
  5. Write a Python program to demonstrate the use of default arguments in functions ?
  6. Write a Python program to calculate the electricity bill using user-defined functions and return statements ?
  7. Write a Python program to demonstrate positional, keyword, and default arguments in a payroll management system ?
  8. Write a Python program to find the highest and lowest values in a list using functions ?
  9. Write a Python program to manage student records using functions and return student grades ?
  10. Write a Python program to implement a banking system using functions for deposit, withdrawal, and balance inquiry operations ?
  11. Write a Python program to calculate the Greatest Common Divisor (GCD) of two numbers using a user-defined function ?
  12. Write a Python program to count the number of vowels in a string using a function ?
  13. Write a Python program to calculate the power of a number using a function with parameters ?
  14. Write a Python program to find the second largest number in a list using a function ?
  15. Write a Python program to calculate the total and average marks of a student using a function that returns multiple values ?
Previous Topic conditions-based problems Next Topic Strings: Indexing, slicing, split(), strip(), find(), replace(), formatting using f-strings