problemas con la matriz
Publicado por bastian (1 intervención) el 07/07/2019 19:47:58
hola, tengo problemas al cambiar el contenido de la matriz, ya que es una aplicacion para venta de dep. si es posible que me orienten seria genial, dejo adjunto el codigo para saber en que me estoy equivocando, de antemano muchos tenkiu
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
from numpy import array
from tabulate import tabulate
import os
seguir=True
tope=0
m=[[10,'✓','✓','✓','✓'],[9,'✓','✓','✓','✓'],[8,'✓','✓','✓','✓'],[7,'✓','✓','✓','✓'],[6,'✓','✓','✓','✓'],[5,'✓','✓','✓','✓'],[4,'✓','✓','✓','✓'],[3,'✓','✓','✓','✓'],[2,'✓','✓','✓','✓'],[1,'✓','✓','✓','✓']]
f=0
c=0
pisos=[]
types=[]
RUN=[]
tipoa=3800
tipob=3000
tipoc=2800
tipod=3500
totalesa=0
totalesb=0
totalesc=0
totalesd=0
totalesar=0
totalesbr=0
totalescr=0
totalesdr=0
contadoresa=0
contadoresb=0
contadoresc=0
contadoresd=0
totalconten=0
total_abcd=0
totalr=0
total_total=0
while(seguir):
os.system('cls')
print("----INMOBILIARIA “MURITO”----")
print(" ")
print("-----------------------------------")
print("1. Comprar departamento")
print("2. Mostrar departamentos disponibles")
print("3. Ver listado de compradores")
print("4. Buscar comprador")
print("5. Reasignar compra")
print("6. Mostrar ganancias totales")
print("7. Salir")
print("-----------------------------------")
print(" ")
op=int(input("Digite opcion 1-2-3-4-5-6-7: "))
if(op==1):
print("-------Ingresando Información de los departamentos-------")
tope=int(input("Cuantos departamentos necesita ingresar?: "))
x=0
while (x < tope):
piso = 0
while (piso <= 0) or (piso>=11):
piso = int(input("Cuales departamentos de los pisos 1-2-3-4-5-6-7-8-9-10 desea comprar: "))
if (piso == 0) or (piso>=11):
print("ERROR..Debe ingresar un piso valido")
pisos.append(piso)
tipo = ""
while (tipo.upper() != "A" and tipo.upper() != "B" and tipo.upper() != "C" and tipo.upper() != "D"):
tipo = input("Digite tipo de departamento A-B-C-D: ")
if (tipo.upper() != "A" and tipo.upper() != "B" and tipo.upper() != "C" and tipo.upper() != "D"):
print("ERROR..Debe digitar A-B-C-D ")
types.append(tipo)
rut = 0
while (rut <= 0) or (rut>=99999999):
rut = int(input("Ingrese su rut: "))
if (rut <= 0) or (rut>=99999999):
print("Error...ingrese correctamente")
RUN.append(rut)
if piso<=1 and tipo.upper() != "A":
totalcom=tipoa
totalesa+=totalcom
contadoresa+=1
if tipo.upper()!="A":
m[9][0]='x'
elif piso<=1 and tipo.upper() != "B":
totalcom=tipob
totalesb+=totalcom
contadoresb+=1
if tipo.upper()!="B":
m[9][1]='x'
elif piso<=1 and tipo.upper() != "C":
totalcom=tipoc
totalesc+=totalcom
contadoresc+=1
if tipo.upper()!="C":
m[9][2]='x'
elif piso<=1 and tipo.upper() != "D":
totalcom=tipod
totalesd+=totalcom
contadoresd+=1
if tipo.upper()!="D":
m[9][3]='x'
elif piso<=2 and tipo.upper() != "A":
totalcom=tipoa - 100+100*piso
totalesa+=tipoa
totalesar+=100*piso - 100
contadoresa+=1
if piso <= 2 and tipo.upper() != "A":
m[8][0] = 'x'
elif piso <= 3 and tipo.upper() != "A":
m[7][0] = 'x'
elif piso <= 4 and tipo.upper() != "A":
m[6][0] = 'x'
elif piso <= 5 and tipo.upper() != "A":
m[5][0] = 'x'
elif piso <= 6 and tipo.upper() != "A":
m[4][0] = 'x'
elif piso <= 7 and tipo.upper() != "A":
m[3][0] = 'x'
elif piso <= 8 and tipo.upper() != "A":
m[2][0] = 'x'
elif piso <= 9 and tipo.upper() != "A":
m[1][0] = 'x'
elif piso <= 10 and tipo.upper() != "A":
m[0][0] = 'x'
elif piso <= 2 and tipo.upper() != "B":
totalcom = tipob - 100 + 100 * piso
totalesb += tipob
totalesbr += 100 * piso - 100
contadoresb += 1
if piso <= 2 and tipo.upper() != "B":
m[8][1] = 'x'
elif piso <= 3 and tipo.upper() != "B":
m[7][1] = 'x'
elif piso <= 4 and tipo.upper() != "B":
m[6][1] = 'x'
elif piso <= 5 and tipo.upper() != "B":
m[5][1] = 'x'
elif piso <= 6 and tipo.upper() != "B":
m[4][1] = 'x'
elif piso <= 7 and tipo.upper() != "B":
m[3][1] = 'x'
elif piso <= 8 and tipo.upper() != "B":
m[2][1] = 'x'
elif piso <= 9 and tipo.upper() != "B":
m[1][1] = 'x'
elif piso <= 10 and tipo.upper() != "B":
m[0][1] = 'x'
elif piso <= 2 and tipo.upper() != "C":
totalcom = tipoc - 100 + 100 * piso
totalesc += tipoc
totalescr += 100 * piso - 100
contadoresc += 1
if piso <= 2 and tipo.upper() != "C":
m[8][2] = 'x'
elif piso <= 3 and tipo.upper() != "C":
m[7][2] = 'x'
elif piso <= 4 and tipo.upper() != "C":
m[6][2] = 'x'
elif piso <= 5 and tipo.upper() != "C":
m[5][2] = 'x'
elif piso <= 6 and tipo.upper() != "C":
m[4][2] = 'x'
elif piso <= 7 and tipo.upper() != "C":
m[3][2] = 'x'
elif piso <= 8 and tipo.upper() != "C":
m[2][2] = 'x'
elif piso <= 9 and tipo.upper() != "C":
m[1][2] = 'x'
elif piso <= 10 and tipo.upper() != "C":
m[0][2] = 'x'
elif piso <= 2 and tipo.upper() != "D":
totalcom = tipod - 100 + 100 * piso
totalesd += tipod
totalesdr += 100 * piso - 100
contadoresd += 1
if piso <= 2 and tipo.upper() != "D":
m[8][3] = 'x'
elif piso <= 3 and tipo.upper() != "D":
m[7][3] = 'x'
elif piso <= 4 and tipo.upper() != "D":
m[6][3] = 'x'
elif piso <= 5 and tipo.upper() != "D":
m[5][3] = 'x'
elif piso <= 6 and tipo.upper() != "D":
m[4][3] = 'x'
elif piso <= 7 and tipo.upper() != "D":
m[3][3] = 'x'
elif piso <= 8 and tipo.upper() != "D":
m[2][3] = 'x'
elif piso <= 9 and tipo.upper() != "D":
m[1][3] = 'x'
elif piso <= 10 and tipo.upper() != "D":
m[0][4] = 'x'
depas={'nivel':[pisos],
'tipos_depart':[types],
'rut de los compradores':[RUN]}
print(tabulate(depas, headers=['nivel','tipos','rut_comprador'],tablefmt='fancy_grid'))
x = x + 1
pausa = input("presione una tecla para continuar")
if(op==2):
#reemplazar m por entidad de los depas
cont=10
for x in (m):
print(cont,x)
cont-=1
pausa = input("presione una tecla para continuar")
if (op == 3):
depas = {'rut de los compradores': [RUN]}
RUN.sort()
print(tabulate(depas, headers=['rut_comprador'], tablefmt='fancy_grid'))
pausa = input("presione una tecla para continuar")
if(op==4):
busqueda_rut=int(input("¿Cual es el RUT que desea buscar en la base de datos?: "))
if busqueda_rut in RUN:
print("-------------------------")
print("El rut digitado esta en la base de datos!")
else:
print("-------------------------")
print("Lo sentimos, el RUT digitado anteriormente no se encuentra en nuestra base de datos")
pausa = input("presione una tecla para continuar")
if(op==5):
rut_seguir = True
while rut_seguir:
erase = int(input("Ingrese el RUT que desea anular la compra o cambiar: "))
if erase in RUN:
RUN.remove(erase)
rut_seguir = False
erase_new = int(input("Digite el RUT del nuevo cliente"))
RUN.append(erase_new)
print("El RUT",erase_new," fue agregado con exito!!!")
print("")
else:
print("EL RUT ingresado no se encuentra en la base de datos")
print("")
pausa = input("presione una tecla para continuar")
if (op==6):
#necesario revisar
totalconten+=contadoresa+contadoresb+contadoresc+contadoresd
total_abcd+=totalesa+totalesb+totalesc+totalesd
totalr+=totalesar+totalesbr+totalescr+totalesdr
total_total+=total_abcd+totalr
print("Tipos de departamentos | Cantidad | Total | Recargo por piso")
print(f" Tipo A {tipoa} UF |{contadoresa}|{totalesa} UF| {totalesar} UF")
print(f" Tipo B {tipob} UF |{contadoresb}|{totalesb} UF| {totalesbr} UF")
print(f" Tipo C {tipoc} UF |{contadoresc}|{totalesc} UF| {totalescr} UF")
print(f" Tipo D {tipod} UF |{contadoresd}|{totalesd} UF| {totalesdr} UF")
print("")
print(f" TOTAl {totalconten}{total_abcd} UF + {totalr} UF {total_total} UF")
print("")
pausa = input("presione una tecla para continuar")
if(op==7):
print("----------Programa Terminado----------")
seguir = False
Valora esta pregunta


0