I'm extracting data from a table and I need to find the item code that meets all 4 conditions. For example, I have the lat and long for this item, the lat needs to be within this range and the long need to be within another range, and I need to extract the corresponding item codes that meet both the constraints. Using this item code, I will look for its corresponding value in another dictionary.
if (Lat < 0
and Lat > 0
and Long > 65
and Long < 70):
meetCriteria.append()
finalvalue = dict.values[]
print (finalvalue)
else:
print ('no match')
I think it's looping through all the lines and printing "no match" for each line that doesn't meet the criteria, and for the lines that meet the criteria, it's printing all the finalvalue, not just the ones that meet the criteria. The final product should print the finalvalue for all the items that meet the criteria, and if none match the criteria, it should print one line of 'no match' instead of printing a bunch of those. Also, is there any way to create a boolean variable to store whether it's true or false?
Thank you!
Aucun commentaire:
Enregistrer un commentaire