Skip to content

Instantly share code, notes, and snippets.

@RadoRado
Created February 17, 2015 08:45
Show Gist options
  • Select an option

  • Save RadoRado/ff34aeb2e0241cc4abd2 to your computer and use it in GitHub Desktop.

Select an option

Save RadoRado/ff34aeb2e0241cc4abd2 to your computer and use it in GitHub Desktop.
Example for using main() and if __name__ check
def divisors(n):
result = []
start = 1
while start < n:
if n % start == 0:
result = result + [start]
start += 1
return result
def main():
n = input("Enter n: ")
n = int(n)
print(divisors(n))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment