A lift starts on floor 1 and stops at the floors in stops, in order. Write floors_travelled(stops) to return how many floors it moves in all, up and down. Basements are negative (-1); with no stops, return 0.
floors_travelled([5, 2])→7floors_travelled([1])→0floors_travelled([])→0def floors_travelled(stops):
floor = 1
total = 0
for stop in stops:
# your code here: add this trip's floors (use abs)
# to total; then the lift is at stop
pass
return total
Run tries the examples. When they look right, Submit.