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
      7 of 102

      As the crow flies

      A point is a list of coordinates, like [3, 4]: 3 across, 4 up. Write distance(a, b): how far apart two points are, in a straight line.

      A van drives from the depot at [0, 0] to a house at [3, 4] along the streets: 3 blocks across, then 4 up. A delivery drone flies to the house in a straight line.

      depot [0, 0]house [3, 4]the van, along the streets3 + 4 = 7the drone, straight?
      how far does the drone fly? that’s distance(a, b)
      Your functiondistance(a, b)
      apoints as lists, e.g. [0, 0] and [3, 4]e.g. [0, 0]
      bpoints as lists, e.g. [0, 0] and [3, 4]e.g. [3, 0]
      returnshow far apart they are
      solution.pyLoading Python
      Sign in for an AI hint
      ← Average on the goHow spread out? →