為什麼時間很難:又長又短的那點事
在 W20529 的 291 趟行程中,最長的一趟有多久?最短的一趟有多短?有沒有哪裡看起來不太對勁?
和前面一樣,資料已載入為 onebike_durations。
本練習屬於課程
在 Python 處理日期與時間
練習說明
- 從
onebike_durations計算shortest_trip。 - 從
onebike_durations計算longest_trip。 - 印出結果,先把
shortest_trip與longest_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")