You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB

#coding:utf-8
import statistics
import custom_exception
class Boat:
def __init__(self, boat_id: str, name: str, sismer_id: str, url: str, avatar:str , temperatures: list, positions: list):
self.boat_id = boat_id
self.name = name
self.sismer_id = sismer_id
self.url = url
self.avatar = avatar
self.temperatures = temperatures
self.positions = positions
def __str__(self):
return f"{self.name}"
def get_temp_mean(self):
return statistics.mean(self.temperatures)
def get_northiest_coords(self):
if len(self.positions) == 0:
raise custom_exception.NothingToComapreError(f"{self.name} must have coords to compare")
best = self.positions[0]
for position in self.positions:
if position.is_northiest_than(best):
best = position
return best
def print_details(self):
print(f"[{self.name}({self.boat_id})]\nSISMER ID: {self.sismer_id}\nURL: {self.url}\nAvatar: {self.avatar}")