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