Finding the factors of…

For this challenge you will use an algorithm to find all the factors of a given number.

Factors are numbers we can multiply together to get another number. For instance, factors of 15 are 1, 3, 5 and 15, because 1×15=15 and 3×5 = 15.

Your algorithm will be based on the INPUT – PROCESS – OUTPUT model:

  • INPUT: Ask the user to enter a number,
  • PROCESS: Identify all the factors of this number,
  • OUTPUT: Display all the factors of this number.



Task 1: Python Code

Your task is to implement your algorithm using Python code.

Task 2: Test Plan

Test # Type of Test Input Values Expected Output Actual Output
#1 Valid 12 1,2,3,4,6,12
#2 Valid 21 1,3,7,21
#3 Valid 48 1,2,3,4,6,8,12,16,24,48
#4 Valid 13 1,13

Task 3: Extension Task: Prime Number?

A prime number is a number that has exactly two factors (1 and itself). Which means that a prime number can be divided evenly only by 1, or itself. A prime number must be a whole number greater than 1.

How could you tweak this code to detect if a number is a prime number or not. If a number is a prime number your algorithm should display a message saying so.

Task 4: Extension Task: Simplifying a Fraction

Complete the following two challenges:



The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.5 / 5. Vote count: 13

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!