Created
December 22, 2021 17:37
-
-
Save nda86/1e9f55113fda02c0785fffef2e81e3ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass, field | |
@dataclass | |
class VehicleSpecificationsForm: | |
vehicle_body_length: int | |
vehicle_body_height: int | |
vehicle_body_width: int | |
vehicle_volume_capacity: float = field(init=False) | |
def __post_init__(self): | |
self.vehicle_volume_capacity = ( | |
self.vehicle_body_length * self.vehicle_body_width * self.vehicle_body_height | |
) / 1000000 # см3 в м3 | |
vsf = VehicleSpecificationsForm(vehicle_body_width=195, vehicle_body_height=200, vehicle_body_length=350) | |
print(vsf.vehicle_volume_capacity) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment