Created
November 2, 2017 06:00
-
-
Save sunnyeyez123/17872e859bac845744af78b7d5570ee8 to your computer and use it in GitHub Desktop.
Create a program that asks the user for a number and then prints out a list of all the divisors of that number.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''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.) | |
Source:http://www.practicepython.org/exercise/2014/02/26/04-divisors.html | |
''' | |
num = int(raw_input("Enter a number: ")) | |
for n in range(1,num): | |
if num%n == 0: | |
print n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment