Hey guys I hope you can give some help, I have read alot and cannot come up with a solution.
Here is what I'm trying to do, I return a set of values from a web request
[[1, 0, 1], [2, 0, 1], [3, 0, 1], [4, 0, 1], [5, 0, 1], [6, 0, 1], [7, 0, 1], [8, 0, 1], [9, 0, 1], [10, 0, 1], [11, 0, 1], [12, 0, 1], [13, 0, 1], [14, 0, 1], [15, 4431, 1], [16, 0, 1], [17, 0, 1]]
The first number can go from either 1 to 1 or 1 to 18. I need a statement that the number of returns doesnt matter. So that I could get 1 value such a [1,0,1] or to values [1, 0, 1], [2, 0, 1], [3, 0, 1], [4, 0, 1], [5, 0, 1], [6, 0, 1], [7, 0, 1], [8, 0, 1], [9, 0, 1], [10, 0, 1].
I then want to take the second number and run if statements off of it. Here is my code so far, I just cannot seem to get it to run right. Any adv, I have changed around the length and other information? Im sure its an easy fix but my hair wants to fall out. Any help is greatly appreciated. I put the print statement in there just to make sure I'm not crazy when i was coding. It works without the if, so I'm lost... Thanks guys!
#Get troop counts
troopsnumber = getTroopsAvailable(city)
available_troops = []
for troops in troopsnumber:
available_troops.append(troops)
print available_troops
if len(available_troops) == 14:
overlord = available_troops[14][1]
print "You have ", overlord, " many Overlord"