python - Is there a best way in my code to check for the values in my list? -


i have list of list, let's : list = [[34,50,0],[21,38,0],[48,69,0],[23,90,0],[12,21,0]]

what's best way following:

for in range(112):       j in range(112):         k in list:                if k[0]=i , k[1]=j:                   #                else:                  # else 

it very vague asking, following list comprehension add true list every time k[0]=i , k[1]=j, otherwise false.

values = [true if k[0] == , k[1] == j else false j in range(112) in range(112) k in list] 

just in case wondering, there several problems code want fix, though may pseudo-code:

  1. your indenting off
  2. your name list shadows built-in
  3. you call if k[0]=i , k[1]=j: uses 1 =. should if k[0] == , k[1] == j:

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -