A Python function is a sequence of statements that executes a specific task. A function can take arguments, which are the information passed to the function when it is called. Functions can also return values, which are the result of executing the function.
1). Python function program to add two numbers.
2). Python function program to print the input string 10 times.
3). Python function program to print a table of a given number.
4). Python function program to find the maximum of three numbers.
Input: 17, 21, -9
Output: 21
5). Python function program to find the sum of all the numbers in a list.
Input : [6,9,4,5,3]
Output: 27
6). Python function program to multiply all the numbers in a list.
Input : [-8, 6, 1, 9, 2]
Output: -864
7). Python function program to reverse a string.
Input: Python1234
Output: 4321nohtyp
8). Python function program to check whether a number is in a given range.
Input : num = 7, range = 2 to 20
Output: 7 is in the range
9). Python function program that takes a list and returns a new list with unique elements of the first list.
Input : [2, 2, 3, 1, 4, 4, 4, 4, 4, 6]
Output : [2, 3, 1, 4, 6 ]
10). Python function program that take a number as a parameter and checks whether the number is prime or not.
Input : 7
Output : True
11). Python function program to find the even numbers from a given list.
Input : [1, 2, 3, 4, 5, 6, 7, 8, 9]
Output : [2, 4, 6, 8]
12). Python function program to create and print a list where the values are squares of numbers between 1 to 10.
Input: 1 to 10
Output: 1, 4, 9, 16, 25, 36, 49, 64, 81
13). Python function program to execute a string containing Python code.
14). Python function program to access a function inside a function.
15). Python function program to find the LCM of two numbers.
Input: 12, 20
Output: 60
16). Python function program to calculate the sum of numbers from 0 to 10.
Output: 55
17). Python function program to find the HCF of two numbers.
Input: 24 , 54
Output: 6
18). Python function program to create a function with *args as parameters.
Input: 5, 6, 8, 7
Output: 125 216 512 343
19). Python function program to get the factorial of a given number.
Input: 5
Output: 120
20). Python function program to get the Fibonacci series up to the given number.
Input: 10
Output: 1 1 2 3 5 8 13 21 34
21). Python function program to check whether a combination of two numbers has a sum of 10 from the given list.
Input : [2, 5, 6, 4, 7, 3, 8, 9, 1]
Output : True
22). Python function program to get unique values from the given list.
Input : [4, 6, 1, 7, 6, 1, 5]
Output : [4, 6, 7, 5]
23). Python function program to get the duplicate characters from the string.
Input: Programming
Output: {‘g’,’m’,’r’}
24). Python function program to get the square of all values in the given dictionary.
Input = {‘a’: 4, ‘b’ :3, ‘c’ : 12, ‘d’: 6}
Output = {‘a’: 16, ‘b’ : 9, ‘c’: 144, ‘d’, 36}
25). Python function program to create dictionary output from the given string.
Note: Combination of the first and last character from each word should be
key and the same word will the value in the dictionary.
Input = “Python is easy to Learn”
Output = {‘Pn’: ‘Python’, ‘is’: ‘is’, ‘ey’: ‘easy’, ‘to’: ‘to’, ‘Ln’: ‘Learn’}
26). Python function program to print a list of prime numbers from 1 to 100.
27). Python function program to get a list of odd numbers from 1 to 100.
28). Python function program to print and accept login credentials.
29). Python function program to get the addition with the return statement.
30). Python function program to create a Fruitshop Management system.
31). Python function program to check whether the given year is a leap year.
32). Python function program to reverse an integer.
33). Python function program to create a library management system.
34). Python function program to add two Binary numbers.
35). Python function program to search words in a string.
36). Python function program to get the length of the last word in a string.
37). Python function program to get a valid mobile number.
38). Python function program to convert an integer to its word format.
39). Python function program to get all permutations from a string.
40). Python function program to create a function with **kwargs as parameters.
41). Python function program to create a function local and global variable.