Daily Challenge #227

No account required

The Largest Gap

Find the biggest difference between two neighbouring numbers in a list.

◈ Graded Challenge

Write a function that returns the largest difference between two neighbouring numbers in a list. Return 0 for a list with fewer than two numbers. Input: [3, 9, 4, 20] Output: 16

Name it exactly: def largest_gap(numbers):

3 visible + 2 hidden
loading editor…

Where this fits

The daily challenge is practice, not a course. If you want the concepts behind it taught properly, the curriculum builds from your first web page through to a deployed full-stack application, and every course is free.

Explore the curriculumReference guides