Loading…
Loop from 1 to 100 with a for loop, adding each integer to a running total. Use time.time() to record the start and end times around the loop, but don't print the elapsed time (it varies between runs). Print only one line: LOOPSUM: followed by the total (the sum of 1..100 is 5050), e.g. print("LOOPSUM:", total).
Create a free account to save your progress and reveal the worked answer for this free exercise. The complete practice library is available with Practice Pass or Mastery.
Create a free account to save your progress and reveal the worked answer for this free exercise. The complete practice library is available with Practice Pass or Mastery.