← Back to challenges

Even or Odd Number of Factors

PythonHardmathvalidationlogic

Instructions

Create a function that returns "even" if a number has an even number of factors and "odd" if a number has an odd number of factors.

Examples

factor_group(33) ➞ "even"

factor_group(36) ➞ "odd"

factor_group(7) ➞ "even"

Notes

  • You don't need to actually calculate the factors to solve this problem.
  • Think about why a number would have an odd number of factors.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Snail Race