LearnPy Hub
← Classes & Objects problems
Medium

Elevator

Write class Elevator for floors 0 to top, starting at 0, with go(floor) that moves there (ignoring floors outside the range) and adds the floors travelled to a total. Read top, then requested floors; print the final floor and the total floors travelled.

Input

Top floor, then requests.

Output

One line.

Sample 1

Input
10
5 2 8
Output
8 14

Sample 2

Input
3
7 2
Output
2 2
solution.py
Output appears here
Elevator · Python practice problem · LearnPy Hub