def odd_numbers(n):
return[i for i in range(0,n+1) if i %2!=0]
n=int(input("Enter an integer: "))
result=odd_numbers(n)
print(result)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter