Create model.py
Browse files
model.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def analizar_ventas(inputs):
|
| 3 |
+
ventas_texto = inputs[0] if isinstance(inputs, list) else inputs
|
| 4 |
+
lineas = ventas_texto.strip().split("\n")
|
| 5 |
+
total = 0
|
| 6 |
+
for linea in lineas:
|
| 7 |
+
try:
|
| 8 |
+
partes = linea.split("-")
|
| 9 |
+
precio_x_cantidad = partes[1].strip()
|
| 10 |
+
precio, num_pares = precio_x_cantidad.split("x")
|
| 11 |
+
precio = float(precio.strip())
|
| 12 |
+
num_pares = int(num_pares.strip())
|
| 13 |
+
total += precio * num_pares
|
| 14 |
+
except:
|
| 15 |
+
pass
|
| 16 |
+
return "Bien" if total > 1000 else "Mal"
|