id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

peter@norvig.com numbers > divisors
prev  |  next  |  chance

Given a number n, return a list of all the proper divisors of n, -- that is, the numbers that evenly divide n, including 1, but not including n itself. The list should be in increasing order.


divisors(6) → [1, 2, 3]
divisors(5) → [1]
divisors(24) → [1, 2, 3, 4, 6, 8, 12]

...Save, Compile, Run (ctrl-enter)

def divisors(n):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 250 Post-solution available

Copyright Nick Parlante 2017 - privacy