Skip to content

Instantly share code, notes, and snippets.

@jgarciabu
Created July 27, 2017 18:31
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 jgarciabu/e282aad8b3ba34c0055394c716fd5f97 to your computer and use it in GitHub Desktop.
Save jgarciabu/e282aad8b3ba34c0055394c716fd5f97 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 27 13:53:35 2017
@author: Jeff Garcia
Create a program that asks the user for a number and then prints out a list of
all the divisors of that number. (If you don’t know what a divisor is, it is a
number that divides evenly into another number. For example, 13 is a divisor of
26 because 26 / 13 has no remainder.)
"""
a = int(input("Please enter a number:"))
b = []
for x in range(1, a + 1):
if a % x == 0:
b.append(x)
print(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment