Skip to content

Instantly share code, notes, and snippets.

@ysnerdem
Created January 24, 2018 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ysnerdem/0bd0acc19d0470d0f1b3899e212a9116 to your computer and use it in GitHub Desktop.
Save ysnerdem/0bd0acc19d0470d0f1b3899e212a9116 to your computer and use it in GitHub Desktop.
find the odd divisors of the given number with list comprehension
num = int(input("enter a number:"))
lst = [i for i in range(1, num) if num % i == 0 and i % 2 != 0]
print(lst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment