LearnPy Hub
← Classes & Objects problems
Medium

Car Odometer

Write class Car with an odometer starting at 0 and drive(km) that adds km but prints invalid (and changes nothing) for negative km. Read distances on one line, drive each, then print the odometer.

Input

One line of integers.

Output

Lines.

Sample 1

Input
10 20 30
Output
60

Sample 2

Input
5 -3 5
Output
invalid
10
solution.py
Output appears here
Car Odometer · Python practice problem · LearnPy Hub