开始使用免费开始使用

时间为何棘手:最长与最短

在 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")
编辑并运行代码