Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. def function5(value):
  2. if value == 0:
  3. return random.randint(0,2)
  4.  
  5. table = np.array([[1, 5, 2, 3], [3, 2, 1, 5], [4, 7, -6, 1], [6, 5, 3, -3]])
  6. possibilies =[]
  7. for x in range (0,len(table)):
  8. for y in range (0,len(table[x])):
  9. if table[x][y] == value:
  10. Dict = {'row':x,'column':y,'value':value }
  11. possibilies.append(Dict)
  12.  
  13. if len(possibilies) == 1:
  14. return possibilies[0]['row']
  15.  
  16. maximum = 0
  17. rowEND = 0
  18. for row in possibilies:
  19. if sum(table[row['row']])>maximum:
  20. maximum = sum(table[row['row']])
  21. rowEND = row
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement