porque el ultimo FOR no se ejecuta?
Publicado por Eddie (4 intervenciones) el 18/12/2017 21:39:11
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
gastos=[]
ventas=[]
total=[]
auxx=[]
sucmay=[]
sucmen=[]
for A in range(0,5):
a=int(raw_input("ingrese sucursal: "))
b=int(raw_input("ingrese ventas: "))
ventas.append(b)
c=int(raw_input("ingrese gastos: "))
gastos.append(c)
for B in range(0,5):
g=ventas[B]-gastos[B]
total.append(g)
auxx.append(g)
for pasada in range(1,len(total)):
for posicion in range(len(total)-pasada):
if total[posicion]>total[posicion+1]:
aux=total[posicion]
total [posicion]=total[posicion+1]
total[posicion+1]=aux
for Busqueda in range(0,len(total)):
if total[0]==auxx[Busqueda]:
menor=Busqueda
sucmen.append(menor)
if total[4]==auxx[Busqueda]:
mayor=Busqueda
sucmay.append(mayor)
for indice in range (0,len(auxx)):
if auxx[indice]==sucmay:
if auxx[indice]==auxx[0]:
print "sucursal 1"
if auxx[indice]==sucmay:
if auxx[indice]==auxx[1]:
print "sucursal 2"
if auxx[indice]==sucmay:
if auxx[indice]==auxx[2]:
print "sucursal 3"
if auxx[indice]==sucmay:
if auxx[indice]==auxx[3]:
print "sucursal 4"
if auxx[indice]==sucmay:
if auxx[indice]==auxx[4]:
print "sucursal 5"
else:
"hay un error"
Hola! necesito si alguno puede ayudarme a entender porque el ultimo FOR no se ejecuta, pues quiero con este hacer una comparacion entre un array llamado AUXX y otro llamado SUCMAY, para encontrar su respectivo valor y segun la posicion del mismo mostrar "x" mensaje.
Valora esta pregunta


0