Create a function which returns the number of odd integers in a list (python)
Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions. Thank You! =========================================================================== def odds_in_list(lst): odds = 0 if lst == None: return 0 for num in lst: if num % 2 == 1 or num % 2 == -1: odds += 1 return odds print(odds_in_list([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]))
==================================================================
Get Answers For Free
Most questions answered within 1 hours.