Skip to content

Instantly share code, notes, and snippets.

@hiramf
Created February 28, 2017 18:42
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 hiramf/ecc569963d6f8f517a176370ec643bbf to your computer and use it in GitHub Desktop.
Save hiramf/ecc569963d6f8f517a176370ec643bbf to your computer and use it in GitHub Desktop.
Practice Python: Exercise 4
# -*- coding: utf-8 -*-
b = int(input("please enter an integer:\n"))
print ("The divisors for " + str(b) + " are: ")
for i in range(1,b+1):
if b%i==0:
print(i)
x = [i for i in range(1,b+1) if b%i==0]
print("here is a list of your divisors for " + str(b) + ":\n" + str(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment