Car
Car
Bases: Vehicle
A car class which inherits from Vehicle.
Source code in src/car.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
brand: str
property
Return the brand of the car.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the brand of the car |
__init__(num_of_wheels, brand)
Initialise a car with the given number of wheels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_of_wheels |
int
|
the number of wheels a vehicle has |
required |
Source code in src/car.py
7 8 9 10 11 12 13 14 15 |
|
drive(num_of_miles)
Drive the vehicle for a given number of miles
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_of_miles |
float
|
how far to drive the vehicle |
required |
Source code in src/car.py
28 29 30 31 32 33 34 35 36 37 |
|