Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Bicycle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from Vehicle import Vehicle

class Bicycle(Vehicle):
def __init__(self, brand, model, year, gear_count):
super().__init__(brand, model, year)
self.gear_count = gear_count

def display_info(self):
"""Override the parent class method for a Bicycle."""
return f"Bicycle: {self._brand} {self._model}, Gears: {self.gear_count} ({self._year})"

def ring_bell(self):
"""Specific implementation for a bicycle."""
return "Ring ring!"

def pedal(self):
"""Simulate pedaling the bicycle."""
return "Keep pedaling! You rock!!"
3 changes: 3 additions & 0 deletions Vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ def fuel_up(self):

def brake(self):
print("Braking the car.")

def check_maintenance(self):
return f"{self._brand} {self._model} needs a checkup soon!"