parent
e4a1805066
commit
6699910ff1
@ -1,14 +1,16 @@
|
||||
#! encoding: utf-8
|
||||
|
||||
from rest_api_boats_loader import RestApiBoatsLoader
|
||||
from sys import argv
|
||||
import fleet
|
||||
from rest_api_boats_loader import RestApiBoatsLoader
|
||||
|
||||
if len(argv) <= 1:
|
||||
raise Exception("You must give the year you want to get")
|
||||
year = int(argv[1])
|
||||
|
||||
boats_loader = RestApiBoatsLoader()
|
||||
|
||||
for boat in boats_loader.load_boats(year):
|
||||
print(boat)
|
||||
my_fleet = fleet.Fleet(year, RestApiBoatsLoader())
|
||||
for boat in my_fleet.boats:
|
||||
boat.print_details()
|
||||
print()
|
||||
northiest_boat, northiest_coords = my_fleet.get_northiest()
|
||||
print(f"The boat which has gone northiest is the {northiest_boat}. It went in {northiest_coords}")
|
||||
|
@ -1,11 +1,13 @@
|
||||
#! encoding: utf8
|
||||
#coding:utf-8
|
||||
|
||||
class Position:
|
||||
def __init__(self, latitude, longitude):
|
||||
def __init__(self, latitude: float, longitude: float):
|
||||
self.latitude = latitude
|
||||
self.longitude = longitude
|
||||
|
||||
def __str__(self):
|
||||
return f"[{self.latitude}; {self.latitude}]"
|
||||
def is_northiest_than(self, position):
|
||||
if position == None:
|
||||
return True
|
||||
return self.latitude >= position.latitude
|
||||
|
Loading…
Reference in new issue