LearnPy Hub
← Inheritance & Special Methods problems
Easy

Cars and Bikes

Write class Vehicle with a name and wheels() returning 0, and subclasses Car (4) and Bike (2) that override it. Read lines type name until END and print NAME has N wheels.

Input

Lines, then END.

Output

Lines.

Sample 1

Input
car Toyota
bike Yamaha
END
Output
Toyota has 4 wheels
Yamaha has 2 wheels

Sample 2

Input
other Boat
END
Output
Boat has 0 wheels
solution.py
Output appears here
Cars and Bikes · Python practice problem · LearnPy Hub