Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      8 of 102

      How spread out?

      Write spread(values): one number for how spread out a list is. 0 means every value is the same; bigger means further apart. The starter uses the biggest minus the smallest. Run it and see.

      Two classes took a quiz out of 10. Each class’s scores start in one pile at its centre and scatter out to where they landed. Both run from 0 to 10, but in the first most people got 5, and in the second most got 0 or 10.

      first class: 0, 5, 5, 5, 10012345678910centre 5spread?second class: 0, 0, 5, 10, 10012345678910centre 5spread?
      click a dot to see its gap from the centreone number for how spread out each class is: that’s spread(values)
      Your functionspread(values)
      valuesa list of numberse.g. [7, 7, 7, 7]
      returnshow spread out they are (0 if all the same)
      solution.pyLoading Python
      Sign in for an AI hint
      ← As the crow fliesWho did better? →