Python Function-Based Programs — Class 12 (CBSE Board) with Solutions & Video Explanatio
This page contains a collection of Python function-based programming questions based on the CBSE Class 12 Computer Science (083) board-exam pattern.
Each program includes:
- ✔ View Solution (Code + Output + Explanation)
- ✔ Watch Video Explanation (Step-by-step understanding)
This resource is useful for exam preparation, practical files, viva-voce, and revision.
🧭 How to Use This Page
- Click View Solution → to open the full program page
- Click Watch Video → to view the explanation on YouTube
📝 CBSE Class 12 — Python Functions Programs
| S.No | Program Title | View Solution | Watch Video |
|---|---|---|---|
| 1 | Write a function dispBook(BOOKS) in Python, that takes a dictionary BOOKS as an argument and displays the names in uppercase of those books whose name starts with a consonant. For example, Consider the following dictionary: BOOKS = {1 : “Python”, 2 : “Internet Fundamentals “, 3 :”Networking”, 4 : “Oracle sets”, 5 : “Understanding HTML”} The output should be: PYTHON NETWORKING | 🔗 View Solution | 🎥 Add Link |
| 2 | Write a Python Program containing a function FindWord(STRING, SEARCH), that accepts two arguments : STRING and SEARCH, and prints the count of occurrences of SEARCH in STRING. Write appropriate statements to call the function. For example, if STRING = “Learning history helps to know about history with an interest in history” and SEARCH = ‘history’, The function should display: The word history occurs 3 times. | 🔗 View Solution | 🎥 Watch Explanation |
| 3 | Write a function Show_sal(EMP) in python that takes the dictionary, EMP as an argument. Display the salary if it is less than 25000. Consider the following dictionary EMP = {1 : 18000, 2 : 25000, 3 : 28000, 4 : 15000} The output should be: 18000 15000 | 🔗 View Solution | 🎥 Watch Explanation |
| 4 | Write a function, VowelWords(Str), that takes a string as an argument and returns a tuple containing each word which starts with an vowel from the given string. For example, if the string is “An apple a day keeps the doctor away”, the tuple will have (“An”,”apple”,”a”, “away”) | 🔗 View Solution | 🎥 Watch Explanation |
| 5 | Write a function EVEN_LIST(L), where L is the list of elements passed as argument to the function. The function returns another list named ‘even list’ that stores even numbers in the list. For example: If L contains [1,2,3,4,5,6,7,8] The even list will have – [2,4,6,8] | 🔗 View Solution | 🎥 Watch Explanation |
| 6 | Write a function shiftn(L,n), where L is a list of integers and n is an integer. The function should return a list after shifting n number of elements to the left. Example: If the list initially contains [2, 15, 3, 14, 7, 9, 19, 6, 1, 10] and n=2 then function should return [3, 14, 7, 9, 19, 6, 1, 10, 2, 15] If the list initially contains [2, 15, 3, 14, 7, 9, 19, 6, 1, 10] and n = 4 then function should return [7, 9, 19, 6, 1, 10, 2, 15, 3, 14] | 🔗 View Solution | 🎥 Watch Explanation |
| 7 | Write a function INDEX_LIST(L), where L is the list of elements passed as argument to the function. The function returns another list named ‘indexList’ that stores the indices of all Non- Zero Elements of L. For example: If L contains: [2, 0, 5, 0, 1, 0, 0] The indexList will have: [0,2,4] | 🔗 View Solution | 🎥 Watch Explanation |
| 8 | Write definition of a function Count_How_Many(Data, item) to count and display number of times the value of item is present in the list Data. (Note: don’t use the count() function) For example: If the Data contains [101,102,107,105,102,103,104,102] and item contains 102 The function should display 102 found 3 Times. | 🔗 View Solution | 🎥 Watch Explanation |
| 9 | Write a function countNow(PLACES) in Python, that takes the dictionary, PLACES as an argument and displays the names (in uppercase)of the places whose names are longer than 5 characters. For example, Consider the following dictionary PLACES={1:”Delhi”,2:”London”,3:”Paris”,4:”New York”,5:”Doha”} The output should be: LONDON NEW YORK | 🔗 View Solution | 🎥 Watch Explanation |
| 10 | Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple containing length of each word of a string. For example, if the string is “Come let us have some fun”, the tuple will have (4, 3, 2, 4, 4, 3) | 🔗 View Solution | 🎥 Watch Explanation |
| 11 | Write a function INDEX_LIST(L), where L is the list of elements passed as argument to the function. The function returns another list named ‘indexList’ that stores the indices of numbers divisible by 10 Elements of L. For example: If L contains [20,40,12,10,23,50] The indexList will have – [0,1,3,5] | 🔗 View Solution | 🎥 Watch Explanation |
| 12 | Write a function merge_tuple(t1,t2), where t1 and t2 are the tuples of elements passed as argument to the function. The function returns another tuple named that stores the sum of consecutive element of t1 and t2, only if they are of same length else return -1 For example: T1=(1,2,3,4) T2=(5,6,7,8) Then function should return (6,8,10,12) And if T1=(1,2,3) T2=(5,6,7,8) then function should return -1 | 🔗 View Solution | 🎥 Watch Explanation |
| 13 | Write a function SumDiv(L,x), where L is a list of integers and x is an integer; passed as arguments to the function. The function returns the sum of elements of L which are divisible by x or x+1. For example, If L Contains [10, 27, 12, 20, 22] and x is 5 Then function returns 42 (10+12+20) | ||
| 14 | Write a function EvenOdd(L) in python, to add 1 in all odd values and 2 in all even values of the list L. Example: If original elements of the list L are L= [35, 12, 16, 69, 26] The modified list will be L= [36, 14, 18, 70, 28] | ||
| 15 | Write a function even(L), where L is the list of elements passed as argument to the function. The function return another list named changelist that stores even numbers. Sample List: [1,2,3,4,5,6,7,8,9] Expected Result: [2,4,6,8] |
🧩 More Class-12 Function Programs Coming Soon
Upcoming additions:
- 🔹 PYQ-based function programs
- 🔹 Output-based questions
- 🔹 Practical-oriented exercises
This page will be updated regularly.
🔗 Related Program Collections (Class 12)
- Python Dictionary Programs — Class 12
- Python String Programs — Class 12
- Python File Handling Programs — Class 12
- Python List & Tuple Programs — Class 12
🎯 Conclusion
This hub helps Class 12 students to:
- Practice function-based Python programs
- Learn concepts through solutions & explanations
- Prepare confidently for CBSE Board Exams & Practicals