This repository has been archived by the owner on Aug 16, 2023. It is now read-only.
generated from UF-LP2/Python_Project_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (39 loc) · 1.76 KB
/
main.py
1
2
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from src.archivos import readFile
from src.Ship import Ship
from src.Cruise import Cruise
from src.Cargo import Cargo
def main() -> None:
lista = readFile()
for i in range(1, len(lista)):
if lista[i][0] and lista[i][1] and lista[i][2] and lista[i][3] and (lista[i][3] == "0.25" or lista[i][3] == "0.5" or lista[i][3] == "1"):
# estan todas las columnas llenas en esa posicion --> CARGO
barcoCargo = Cargo(float(lista[i][2]), float(lista[i][3]), float(lista[i][0]), float(lista[i][1]))
print(f"Barco N°{barcoCargo.contador} - TIPO: Cargo")
try:
pesoFinal = barcoCargo.is_worth_it()
if pesoFinal >= 20:
print("Merece ser saqueado.")
except Exception as e:
print(str(e))
elif lista[i][0] and lista[i][1] and lista[i][2] and (lista[i][3] != "0.25" or lista[i][3] != "0.5" or lista[i][3] != "1"):
# estan solo cargadas las primeras tres columnas --> CRUISE
barcoCruise = Cruise(float(lista[i][2]), float(lista[i][0]), float(lista[i][1]))
print(f"Barco N°{barcoCargo.contador} - TIPO: Cruise")
try:
pesoFinal = barcoCruise.is_worth_it()
if pesoFinal >= 20:
print("Merece ser saqueado.")
except Exception as e:
print(str(e))
elif lista[i][0] and lista[i][1] and not lista[i][2]: #Asumimos que si la lista[i][3] esta llena con algun valor, es error.
# estan solo cargadas las primeras dos columnas --> SHIP
barcoShip = Ship(float(lista[i][0]), float(lista[i][1]))
print(f"Barco N°{barcoCargo.contador} - TIPO: Ship")
try:
pesoFinal = barcoShip.is_worth_it()
if pesoFinal >= 20:
print("Merece ser saqueado.")
except Exception as e:
print(str(e))
if __name__ == "__main__":
main()