Exp-5 Python Functions
Exp-5 Python Functions
Theory:-
Contents covered:
1. Arguments
2. Recursion
3. Anonymous function
4. Global, local and non local
5. Global keyword
6. Modules
7. Package
https://www.javatpoint.com/python-functions
Conclusion:-Write the crux of the experiment. Here crux means very important point,
complicated and again it should be understandable by you. Do not write conclusion like thus we
have studied the ……….. in C programming.
Problem Statement:
2. Write a Python function to sum all the numbers in a list. Sample List : (8, 2, 3, 0, 7)
Expected Output : 20
3. Write a Python function to multiply all the numbers in a list. Sample List : (8, 2, 3, -1, 7)
Expected Output : -336
4. Write a Python program to reverse a string.
7. Write a Python function that accepts a string and calculate the number of upper case
letters and lower case letters.
Sample String : 'The quick Fire Fox'
Expected Output :
No. of Upper case characters : 3
No. of Lower case Characters : 12
8. Write a Python function that takes a list and returns a new list with unique elements of the
first list. Sample List : [1,2,3,3,3,3,4,5]
Unique List : [1, 2, 3, 4, 5]
9. Write a Python program to print the even numbers from a given list.
Sample List : [1, 2, 3, 4, 5, 6, 7, 8, 9]
Expected Result : [2, 4, 6, 8]
10. Write a Python program to detect the number of local variables declared in a function.