{"id":20432,"date":"2021-09-12T12:01:53","date_gmt":"2021-09-12T06:31:53","guid":{"rendered":"https:\/\/python-programs.com\/?p=20432"},"modified":"2021-11-22T18:36:21","modified_gmt":"2021-11-22T13:06:21","slug":"python-program-to-find-sum-of-odd-numbers-using-recursion-in-a-list-array","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-sum-of-odd-numbers-using-recursion-in-a-list-array\/","title":{"rendered":"Python Program to Find Sum of Odd Numbers Using Recursion in a List\/Array"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Check Armstrong Number using Recursion<\/a><\/p>\n

Given a list and the task is to find the sum of odd numbers using recursion in a given list in python.<\/p>\n

Recursion:<\/strong><\/p>\n

Recursion is the process by which a function calls itself directly or indirectly, and the associated function is known as a recursive function. Certain issues can be addressed fairly easily using a recursive approach. Towers of Hanoi (TOH), Inorder \/Preorder\/Postorder Tree Traversals, DFS of Graph, and other analogous issues are examples.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List = [6, 12, 4, 2, 3, 9, 1, 5]<\/pre>\n

Output:<\/strong><\/p>\n

The Sum of Odd Elements in a given list [6, 12, 4, 2, 3, 9, 1, 5] = 18<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List = [4, 3, 1, 5, 11]<\/pre>\n

Output:<\/strong><\/p>\n

The Sum of Odd Elements in a given list [4, 3, 1, 5, 11] = 20<\/pre>\n

Program to Find Sum of Odd Numbers Using Recursion in a List\/Array in Python<\/h2>\n

Below are the ways to find the sum of odd numbers using recursion in a given list in python:<\/p>\n