開始使用免費開始

為什麼時間很難:又長又短的那點事

在 W20529 的 291 趟行程中,最長的一趟有多久?最短的一趟有多短?有沒有哪裡看起來不太對勁?

和前面一樣,資料已載入為 onebike_durations

本練習屬於課程

在 Python 處理日期與時間

檢視課程

練習說明

  • onebike_durations 計算 shortest_trip
  • onebike_durations 計算 longest_trip
  • 印出結果,先把 shortest_triplongest_trip 轉成字串以便列印。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Calculate shortest and longest trips
shortest_trip = ____(____)
longest_trip = ____(____)

# Print out the results
print("The shortest trip was " + ____ + " seconds")
print("The longest trip was " + ____ + " seconds")
編輯並執行程式碼