How can I identify an element from a list within another list

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2011-03-17T16:07:04Z Indexed on 2011/03/17 16:09 UTC
Read the original article Hit count: 199

Filed under:
|
|

I have been trying to make a block of code that finds the index of the largest bid for each item. Then I was going to use the index as a way to identify the person who paid that much moneys name. However no matter what i try I can't link the person and what they have gained from the auction together. Here is the code I have been writing: It has to be able to work with any information inputted

def sealedBids():
      n = int(input('\nHow many people are in the group? '))
      z = 0
      g = []
      s = []
      b = []
      f = []
      w = []#goes by number of items
      q = []
      while z < n:
            b.append([])
            z = z + 1
      z = 0
      while z < n:
            g.append(input('Enter a bidders name: '))
            z = z + 1
      z = 0
      i = int(input('How many items are being bid on?'))

      while z < i:
            s.append(input('Enter the name of an item: '))
            w.append(z)
            z = z + 1
      z = 0
      for j in range(n):#specifies which persons bids your taking
            for k in range(i):#specifies which item is being bid on
                  b[j].append(int(input('How much money has {0} bid on the {1}? '.format(g[j], s[k]))))
            print(' ')
      for j in range(n):#calculates fair share
            f.append(sum(b[j])/n)
      for j in range(i):#identifies which quantity of money was the largest for each item
            for k in range(n):
                  if w[j] < b[k][j]:
                        w[j] = b[k][j]
                        q.append(k)

any advice is much appreciated.

© Stack Overflow or respective owner

Related posts about python

Related posts about nested