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|
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:
Solution...The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area