I do not want to use while or for loops, just want to use recursion to return the odd numbers in a given list. Thanks!
I do not want to use while or for loops, just want to use recursion to return the odd numbers in a given list. Thanks!
def find_odds(numbers):if not numbers:return []if numbers[0] % 2 == 1:return [numbers[0]] + find_odds(numbers[1:])return find_odds(numbers[1:])
No extra variables or parameters needed.