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

      Average speed

      A trip is made of legs that are all the same distance, each driven at its own speed. Write average_speed(speeds): one speed for the whole trip.

      You drive 60 km/h there and 30 km/h back, the same distance each way. Your function gets each leg’s speed and hands back one speed for the whole trip.

      there and back · every leg 60 kmthe real tripthere · 60 km/hback · 30 km/h0 hone speed the whole waythere · ? km/hback · ? km/h?

      type a speed to try one

      Your functionaverage_speed(speeds)
      speedsone per leg, in km/h; every leg is the same distancee.g. [50, 50]
      returnsone speed for the whole trip
      solution.pyLoading Python
      Sign in for an AI hint
      ← Average growthAverage on the go →