← Back to challenges

Is the Sequence Linear, Quadratic or Cubic?

PythonHardrecursionalgorithmsmath

Instructions

Create a function that determines if a given sequence is linear, quadratic or cubic. The input will be a list of numbers of varying lengths. The function should return "Linear", "Quadratic" or "Cubic".

Examples

seq_level(1, 2, 3, 4, 5) ➞ "Linear"

seq_level(3, 6, 10, 15, 21) ➞ "Quadratic"

seq_level(4, 14, 40, 88, 164) ➞ "Cubic"

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.