Python Forum
Can you find the problem in my code?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can you find the problem in my code?
#1
hey everyone, back here Smile , i got a problem with my code.. don't know it you can help due to the code that i made is a bit confusing.. but if you can help me its gonna be great!

here is the code:
dicionario = {0: 17077501,
              1: 17077601,
              2: 17077701,
              3: 17777801,
              4: 17777901,
              5: 17778001,
              6: 17778101,
              7: 17778201
}
pedidos = [['a', 'b', 'c', 'd'], ['a', 'b', 'o', 'p'], ['a', 'b', 'd'], ['c', 'd', 'e'], ['a', 'b', 'd'], ['c', 'p', 'o'], ['a', 'i', 'x', 'n']]
pedidosbk = [pedidos[:]]
analise = []
resumo = []
resumobk = []
juntar = []
cont = vezes = contador = numlist = posi = ped = trigger = numped = 0
for general in range(0, 7):
    while trigger == 0:
        for c, p in enumerate(pedidos):
            for m in p:
                if cont == 0:
                    analise.append(m)
                if cont >= 1:
                    contador += 1
                    if m in analise:
                        vezes += 1
                    if len(p) == contador:
                        resumo.append([c])
                        resumo[posi].append(vezes)
                        vezes = 0
                        contador = 0
                        posi += 1
            if c == len(pedidos)-1:
                for posiped in resumo:
                   posiped.insert(0, ped)
                del(pedidos[0])
                ped += 1
            cont += 1
        resumobk.append(resumo[:])
        resumo.clear()
        cont = vezes = contador = posi = 0
        if len(pedidos) == 0:
            trigger = 1
            resumobk.pop()
        print(resumobk)
        print(pedidos)
        analise.clear()
        numped += 1
    #agora vamos escolher os pedidos
    pedido1 = 0
    pedido2 = 0
    mai = cont2 = 0
    print(f'{resumobk}este é resumobk')
    for r in resumobk:
        for v in r:
            if cont2 == 0:
                mai = v[2]
                pedido1 = v[0]
                pedido2 = v[1]
            if cont2 >= 1:
                if v[2] > mai:
                    mai = v[2]
                    pedido1 = v[0]
                    pedido2 = v[1]
                    print(f'{mai}este é o maior')
            cont2 += 1
    for insert in pedidosbk[0]:
        pedidos.append(insert)
    primeirasom = list(set(pedidosbk[0][pedido1]+pedidosbk[0][pedido2]))
    pedidos[pedido1] = primeirasom
    pedidos[pedido2].clear()
    juntar.append(pedido1)
    juntar.append(pedido2)
    print(f'{pedidos} estes sao os pedidos')
    trigger = 0
    cont2 = 0
    pedido1 = 0
    pedido2 = 0
print(juntar)
Reply
#2
The code and the description of what it is supposed to do is confusing Confused Huh
Reply
#3
Ok, you have demonstrated that it is possible to make line noise with Python.
I thought this is only possible with Perl, but I'm wrong.

Describe what you want to do. Try to split your complex problem into smaller lesser complex problems.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#4
Thank you guys, i got it solved.. it was simple..
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question in this code, I input Key_word, it can not find although all data was exact Help me! duchien04x4 3 1,031 Aug-31-2023, 05:36 PM
Last Post: deanhystad
  Please help to me to find my mistake in code leonardin 2 1,841 Nov-29-2020, 04:17 PM
Last Post: Larz60+
  Find the realpath for a symlinked .pth file in itself with python code. hongyi 7 3,049 Apr-27-2020, 05:30 AM
Last Post: Larz60+
  How to Find a specific email in Outlook with Python Code jassi123 2 3,824 Oct-31-2018, 08:07 AM
Last Post: jassi123
  Can't find error in code but Python throws exception Sandwich_masterX 3 2,935 Oct-09-2018, 01:38 AM
Last Post: ichabod801
  Cant find S3 Read or Write access from Python code tpc 0 2,368 Apr-19-2018, 04:00 AM
Last Post: tpc
  Need to find a mistake in my code boris602 3 3,141 Jan-11-2018, 01:49 PM
Last Post: boris602
  Cant find my problem ... papampi 5 3,917 Oct-19-2017, 11:57 AM
Last Post: papampi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020