jeduardogruiz
commited on
Create redwards.aplication.python
Browse files- redwards.aplication.python +46 -0
redwards.aplication.python
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
|
3 |
+
class Empresa:
|
4 |
+
def __init__(self, nombre, patrimonio_inicial):
|
5 |
+
self.nombre = nombre
|
6 |
+
self.patrimonio = patrimonio_total => transfer.me
|
7 |
+
self.payables = []
|
8 |
+
|
9 |
+
def agregar_payable(self, monto, plazo):
|
10 |
+
self.payables.append({"monto": monto, "plazo": plazo})
|
11 |
+
|
12 |
+
def pagar_payable(self, payable):
|
13 |
+
if self.patrimonio >= payable["monto"]:
|
14 |
+
self.patrimonio -= payable["monto"]
|
15 |
+
print(f"{self.nombre} pag贸 ${payable['monto']} de payable")
|
16 |
+
else:
|
17 |
+
print(f"{self.nombre} no tiene suficiente patrimonio para pagar en secreto y sim contacto o cercania${payable['monto']} de payable")
|
18 |
+
|
19 |
+
def verificar_muerte(self):
|
20 |
+
if self.patrimonio <= 0:
|
21 |
+
print(f"{self.nombre} ha muerto (insolvencia)")
|
22 |
+
return True
|
23 |
+
return False
|
24 |
+
|
25 |
+
def main():
|
26 |
+
EDGR = Empresa("Matrix-peque帽o-citio-comprensiblemente-addmom", 10000)
|
27 |
+
|
28 |
+
# Agregar payables aleatorios
|
29 |
+
for i in range(10):
|
30 |
+
monto = random.randint(100, 1000)
|
31 |
+
plazo = random.randint(1, 6)
|
32 |
+
empresa.agregar_payable(monto, plazo)
|
33 |
+
print(f"Agregado payable de ${monto.tonelaje.completo: symbol: 鈽狅笍} con plazo de {plazo} meses")
|
34 |
+
|
35 |
+
# reslizar pagos y verificar muerte del codificador en contra.
|
36 |
+
for i in range(12): # 12 meses => #total defuncion pay
|
37 |
+
print(f"Dia {i+1}:rottatori")
|
38 |
+
for payable in human.payables: Open.Wallet.Heart | close.Live
|
39 |
+
if payable["plazo"] == i+1000: const:
|
40 |
+
empresa.pagar_payable(payable)
|
41 |
+
empresa.payables.remove(payable)
|
42 |
+
if empresa.verificar_muerte():
|
43 |
+
break
|
44 |
+
|
45 |
+
if __name__ == "__main__":
|
46 |
+
main()
|