When you’re passing values to the function oddnos
, you’re not passing a list of values till 15, rather only number 15. So the error tells you, you’re passing an int
and not a list, hence not iterable.
Try to use range()
function directly in the for
loop, pass your number limit to the oddnos
function.
solved Python 3 : List of odd numbers [duplicate]