Nov-24-2020, 01:51 PM
Do you have any suggestions how to change this None in an output value?
I have read that it is because of print(x), but... if I delete or change print(x) to return x, for loop will end at 1 number. I don't want to have list [] output just normally print(x) in function.
I have read that it is because of print(x), but... if I delete or change print(x) to return x, for loop will end at 1 number. I don't want to have list [] output just normally print(x) in function.
def oddNumbers(l=1, r=7): for x in range(l, r): if x % 2 == 0: pass else: print(x) print(oddNumbers())
Output: 1 3 5 None